Page 1 of 1

NHibernate, setting a property to lazy

Posted: Sun 27 Jan 2013 21:31
by kindbergs.dk
Using Entity Developer for NHibernate version 4.7.313 to generate mappings, when I set a property/database field to Lazy (f.ex. due to that field containing a big blob that I don't want to load when presenting lists), NHibernate add the following to my log4net log:

(date) [8] ERROR NHibernate.Tuple.Entity.EntityMetamodel - Lazy or no-proxy property (name of field) is not an auto property, which may result in uninitialized property access

How do I avoid NHibernate giving this error?
Is there something specific I need to choose in the mapping of the field in Entity Developer, in addition to just changing the "lazy" to "true", to avoid the error?
Or is it a bug in the Entity Developer export to xml files?

Note: I think the lazy part works, but I just want to be sure it works optimally.

Re: NHibernate, setting a property to lazy

Posted: Mon 28 Jan 2013 18:04
by Shalex
kindbergs.dk wrote:(date) [8] ERROR NHibernate.Tuple.Entity.EntityMetamodel - Lazy or no-proxy property (name of field) is not an auto property, which may result in uninitialized property access
Please treat this message as a warning.
NHibernate requires lazy or no-proxy property to be an auto property. The current implementation of our standard templates doesn't allow to use auto-properties because of supporting INotifyChanging, INotifyChanged and other property features. We will investigate the possibility of generating auto-properties by our templates and post here about the results.

Re: NHibernate, setting a property to lazy

Posted: Mon 28 Jan 2013 19:51
by kindbergs.dk
Okay, thanks.
It was also my impression that it worked, so from now on I will ignore the 'warning' in my logs :roll:
By the way, thanks for making a really powerful tool - I would not use NHibernate without it!

Re: NHibernate, setting a property to lazy

Posted: Tue 29 Jan 2013 17:16
by Shalex
The behaviour is changed: .NET auto-properties are generated in code if both Property ChangeNotifiers and Property Change Partial Methods properties of a template are set to False. We will post here when the corresponding build of Entity Developer is available for download.

Re: NHibernate, setting a property to lazy

Posted: Thu 07 Feb 2013 12:44
by Shalex
New build of Entity Developer 5.0.43 is available!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=32&t=25825.