Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ul> <li>For NHibernate: <ul> <li>All mapped classes require a default (no-arguments) constructor. The default constructor does not have to be public (it can be private so that it is not a part of the API), but it must exist. This is because NHibernate must be able to create an instance of the mapped class without passing any arguments. (There are workarounds, but don't do that.)</li> <li>All mapped properties for which lazy-loading will be required must be marked <code>virtual</code>. This includes all reference properties and all collection properties. This is because NHibernate must be able to generate a proxy class deriving the mapped class and overriding the mapped property.</li> <li>All mapped collection properties should use an interface as the property type. For example, use <code>IList&lt;T&gt;</code> rather than <code>List&lt;T&gt;</code>. This is because the collections types in the .NET Framework tend to be sealed, and NHibernate must be able to replace a default instance of the collection type with its own instance of the collection type, and NHibernate has its own internal implementations of the collection types.</li> <li>For NHibernate, prefer <code>Iesi.Collections.Generic.ISet&lt;T&gt;</code> to <code>System.Collections.Generic.IList&lt;T&gt;</code>, unless you are sure that what you want is actually a <em>list</em> rather than a <em>set</em>. This requires being conversant in the theoretical definitions of <em>list</em> and <em>set</em> and in what your domain model requires. Use a list when you know that the elements must be in some specific order.</li> </ul></li> </ul> <p>Also note that it's typically not easy to swap object-relational mapping frameworks, and in many cases it is impossible, when you have anything beyond a trivial domain model.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload