I'm working on a WPF example, but this post could help you too: http://nhforge.org/blogs/nhibernate/archive/2009/08/15/nhibernate-and-wpf-models-concept.aspx <http://jfromaniello.blogspot.com/2009/08/chinook-media-manager-models-concept.html>
2009/8/22 José Romaniello <[email protected]> > 2009/8/22 ChrisHolmes <[email protected]> > >> >> I've looked at this blog post before I posted to this message group, >> and it just doesn't make any sense to me. I don't see how to use it in >> an actual application scenario. I can't tell if there are multiple >> sessions, or just one session for the entire application? > > > Why don't make any sense to you? > > > >> >> >> What is a recommended approach to a WinForm application? One session >> for the life of the WinForm app? > > > This is not recommended pattern. (time bomb) > > > >> Or multiple sessions? How long should >> a session live? > > it depends. > > >> Who controls when a session is created and when it >> dies? > > > depends uppon the conversation. have a look to the attributes. > > > >> How does that control propagate to repositories or other lower- >> level code that actually needs to make use of the session? Or do you >> not even worry about abstracting the NHibernate stuff away, and just >> use the ISession as a unit of work in the actual application? > > > My concrete implementation of repositories have a dependency to > sessionfactoy. > Inside I use SessionFactory.GetCurrentSession(). > > > look the winform example at unhaddins. > > > > > >> >> >> I have yet to see anyone explain this clearly. >> >> -Chris >> >> On Aug 22, 9:53 am, Fabio Maulo <[email protected]> wrote: >> > http://fabiomaulo.blogspot.com/2009/01/aspect-conversation-per.html< >> http://fabiomaulo.blogspot.com/2009/01/aspect-conversation-per.html>Start >> > from the first of the serie >> > >> > Examplehttp:// >> code.google.com/p/unhaddins/source/browse/#svn/trunk/Examples/... >> > >> > 2009/8/22 ChrisHolmes <[email protected]> >> > >> > >> > >> > >> > >> > > Hey gang, >> > >> > > I'm trying to figure out the best way to handle the NHibernate session >> > > in a WinForm scenario. I've Googled this to death and I still can't >> > > find anything that makes sense and I haven't found any actual code >> > > that I can read and make sense out of. I've read a lot about Session- >> > > per-Request and at the conceptual level it makes sense, but I haven't >> > > seen code that makes sense (and the context for this pattern is often >> > > web, which doesn't work for me). >> > >> > > If anyone has any suggestions or best practices, particularly any code >> > > or pseudo code that I can read to get a clear understanding of the >> > > parts involved and how they interact, I'd appreciate it. >> > >> > > Details about my application: From the application point of view, it's >> > > easy for me to create boundaries for a unit of work. I basically have >> > > a controller class that is responsible for creating/managing views in >> > > a MVP fashion, and then handling some elementary coordination. So the >> > > controller works as a pretty good UoW boundary; it's very feature >> > > specific. But what I can't figure out is how the NHibernate session is >> > > actually best managed in this scenario, how the abstractions are >> > > handled, and how the session relates to other things that need to make >> > > use of it (like a Repository). >> > >> > > I'm using StructureMap for IoC, and I'd really like to take advantage >> > > of that. This is something that is in the greenfield arena, and in the >> > > very beginning phases of development, and I want to make good >> > > decisions about this design up-front. >> > >> > > Appreciate any help anyone can lend. >> > >> > > -Chris >> > >> > -- >> > 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 -~----------~----~----~----~------~----~------~--~---
