0

Is it possible to bind to a "get value" event for every property of a class of the domain model using nhibernate interceptors?
What i would like to do is:
- Have my domain model classes and mappings (nothing new here)
- Using a business layer to handle user requests. This layer should use transactions so a request would behave like this: requst -> open session and transaction -> fulfill request -> commit transaction and close session -> send results back (if any)
- User interacts with data through some kind of GUI. When he asks for some lazy loading data no LazyLoadException (or whatever its name is) is fired because an interceptor is registered and is capable of intercepting the read of a lazy load property. So it opens a nhibernate session and closes it when the read has been performed.

I hope you understand what i mean.
If you desperately need some code samples to clarify i'll try to provide even if i really don't know how to give a programmatic idea.
Any help would be very much appreciated, thanks!

4

1 回答 1

0

我们的 Windows 窗体应用程序使用运行良好的每个窗体模式的会话。在几乎所有情况下,我们一次只能保持一个会话打开。

在您的情况下,我将调查使用ISession.Lock将断开连接的对象重新附加到会话以允许延迟加载工作。

于 2012-12-07T12:46:37.023 回答