Hi all,

I currently need to refactor a big web application using an ORM
framework. I would really like to use nhibernate for this & have done
several tests that show that things would work out well. I have one
problem left though that is giving me headaches:

I want to use one session per request. I will have to use lazy-loading
a lot.
The application does at numerous places store things in the asp.net
session or the asp.net cache.

When the application now loads a lazy property for an object that has
been loaded from there, nhibernate throws - no suprise - a
lazyinitializationexception.
I know I have to reattach the item to the session first.

BUT, due to the sheer size of the application I can't modify/review
all places where that happens (which I know in an ideal world I would
have time to do).

So my question is: Is there any way to intercept the lazy-loading and
check for an existing session previously and reattach if there is
none?
For lazily loaded properties I think I could modify the intercept
method of the generated proxy.
What would I do for lazily loaded collections (where
abstractpersistentcollection throws the exception) though?

The only thing I could come up with so far is to use a AOP framework
like postsharp to intercept the calls, but this would be kind of a
pain too because this would have to be integrated into the general
build process.

Any suggestions for easier ways to solve this?

Any help is much appreciated & sorry in case this already is answered
somewhere that I didn't find.

-- 
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.

Reply via email to