2009/8/12 joniba <[email protected]>

>
> I'm not sure how a custom collection type would help (doesn't
> NHibernate still require that it be implemented as an interface?),


No. It doesn't.


> but, there's been a design change and I've run into a totally
> different problem.
>
> So first, I'd like to ask if anyone out there has implemented their
> own lazy loading solutions using NHibernate where sessions are always
> closed after each operation?


Yes there are. In uNhAddIns José Romaniello is working on lazy-loading
collection in a multi-physical-tear app. btw I know somebody else done it in
the past.



>
>
> If not, is this kind of design, where an ISession is opened for each
> CRUD operation and closed afterwards, a bad design?  I don't want to
> couple the application to NHibernate (we are actually testing it and
> ultimately we may go with a different solution), so I can't have
> session-management issues move outside the repositories assembly where
> NHibernate is used.


WEB or win or WPF ?
The session management should stay out side repository as in a pure
ADO.NETapp the connection/transaction management should stay out side
DAO/Repository.


>
> If it is not definitively bad, or even if it is just reasonable, then
> I'd really like to know how others are implementing custom lazy-
> loading when the parent objects are detached.


Can't.


>
> My hoped-for solution was to use a wrapper like the Lazy<T> class
> suggested by Jeremie here:
> http://thinkbeforecoding.com/post/2009/02/07/Lazy-load-and-persistence-ignorance
> .


For web it is easy and you can find a lot of article about session
management in WEB.
For WPF, Ayende is posting a possible solution, José is posting another
solution, Gustavo done a prj for winForm (in uNhAddIns), I have posted a
pattern.

-- 
Fabio Maulo

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