NHibernate, setting a property to lazy

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
kindbergs.dk
Posts: 15
Joined: Sun 27 Jan 2013 21:14

NHibernate, setting a property to lazy

Post by kindbergs.dk » Sun 27 Jan 2013 21:31

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: NHibernate, setting a property to lazy

Post by Shalex » Mon 28 Jan 2013 18:04

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.

kindbergs.dk
Posts: 15
Joined: Sun 27 Jan 2013 21:14

Re: NHibernate, setting a property to lazy

Post by kindbergs.dk » Mon 28 Jan 2013 19:51

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!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: NHibernate, setting a property to lazy

Post by Shalex » Tue 29 Jan 2013 17:16

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: NHibernate, setting a property to lazy

Post by Shalex » Thu 07 Feb 2013 12:44

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.

Post Reply