There is probably a reason for you not using proxies / lazy loading in
the first place.
But otherwise you can write your own Custom ReflectionOptimizer (just
inherit from ReflectionOptimizer) to use with NHibernate and then
construct domain objects using your own proxy and interceptors. In that
way you can implement your own lazy load. I have done so on a project
where we have some data that needs to be fetched over a webservice. So
bascially NHibernate constructs the domain object using the custom
reflection optimizer and loads data from the database and when certain
properties/methods on the domain object is used the proxy makes sure to
read additional data through webservice and place on the object.
And then in order to get it to work for components you need to fix the
error I mentioned here:
http://groups.google.com/group/nhusers/browse_thread/thread/f330af5058113a6f/cf7d3a9f14aa1513?lnk=gst&q=Henrik+Uffe+Jensen#cf7d3a9f14aa1513
regards, Henrik Jensen
On 21-03-2011 15:53, raffaeu wrote:
Hi eveybody, I have a concern on how the fetch mechanism works in Nhb
3.1 when the domain is plain and does not use a proxy for the lazy
load (see Castle).
In my case I have a simple relation of type:
Person 1 - * Addresses (bag)
Address 1 - 1 ParentPerson (many-to-one)
I noticed that everytime I get an Address from the Db, the
parentPerson is fetched by Nhb using a JOIN or a SELECT depending on
how I configure the fetch attribute in the many-to-one tag.
Of course when the graph gets more complex, the NHB strategy doesn't
really work as Nhb fetch the entire graph in one shot.
Without the Proxy enabled (I can't as I have sealed Domain Model
classes ...) is there any other way of having a lazy load mechanism or
fetchind children and parent "on-demand"?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.