stacky wrote:
Hi guys,
3. Default constructor. I am forced to include a default constructor in all of my entity types. I read previously in Ayendes blog that a patch for fixing this issue. Is there any way of not having to include the default constructor?
Help would really be appreciated as we are currently using LINQ to SQL (temporary due to enforced deadline), which we want to swap out as soon as possible.
For the constructor issue: you can create a private default constructor on the entity types that do not have a default constructor, and for which you don't want to expose a public default constructor.
By making the default constructor private, consumers of your entities will not be able to construct an instance of that entity using the private constructor (it will not even be visible by intellisense i guess), but, since there is a default constructor (although it is private), NHibernate has the ability to use it. :)