Click here to Skip to main content
15,444,490 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to use Fluent Nhibernate ORM in my C# project that needs to connect to Oracle and SQL Server database. I know that I need to create mapping file to map my C# objects to database objects but what I am uncertain is - Is mapping syntax going to be different for these two databases? In one blog, I read that the mappings are a bit different. Is it extra overhead to use Fluent Nhibernate if we are writing mapping file to connect to both databases given that we have alternatives? If possible, please include mapping code for these databases.

What I have tried:

I read some blog and got conflicting answers.
Posted
Comments
Adam Flow 1-Jan-22 20:21pm     CRLF
We use NHibernate with Fluent on both SQL Server and Oracle. I can say, that we use the same Fluent mappings for both databases. There are some slopes, for example: Oracle has a 30 character limit on column and constraint-names (foreign-keys, indexes). So if you keep that in mind and have your column names at 30 characters max. by default, then this is no problem. Also, if you planning to use only the "basic" types (integer, long, string, boolean) in your project, then there should be no problems as well. You will only have to deal with two different NHibernate configurations. Specifically the Database-Driver class, Connection string and Dialect which are in turn just parameters for your NHibernate configuration. No big deal. So, what do you have in mind specifically that could lead to potential issues? What blogs did you read that made you uncertain?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900