Search This Blog

2008-07-18

5 Things You Should Remember about NHibernate

NHibernate is probably the most used ORM (object-relational mapping tool) for .NET applications and it is based in Hibernate the most used ORM in Java for years.
The learning curve to start working with NHibernate can be reduced if you remember the take the following steps:

1) The domain class should have at least one public or protected parameterless constructor

2) The domain classes' public properties and methods must declared with the virtual reserved word

3) For XML mappings, remember to rename your mapping files ending with *.hbm.xml not only *.xml

4) Also for XML mappings, remember to set the property of each file to embedded resource instead of content

5) Avoid using composite-id's classes as much as you can since they don't work very well when used in cascade collections and they make development more difficult

No comments: