I am also interested in the subject. Is there any MVP or MVVM open source framework that can handle winforms ?
On 23 août, 15:36, Fabio Maulo <[email protected]> wrote: > Belvasis, have you post an example some where ?If you want post your > examples in NH-Forge let me know. > Thanks. > > 2009/8/22 Belvasis <[email protected]> > > > > > Hm, I think the first part of the blog describes the how and why of the > > pattern well enough > > >http://fabiomaulo.blogspot.com/2008/12/conversation-per-business-tran... > > > But I think, it will not fit in every scenario of a winform application or > > maybe I didn't understand all of it :-). > > The problem i have is, for example if it comes to lazy loading. Simply > > think of two views, one shows > > a list of data and the other one details for the selected entity, with lazy > > loaded attributes. The two > > views are independed of each other and part of independend use cases. But > > while both usecases may > > be instantiated from one parent usecase they may also be instantiated > > standalone. So the lifetime of > > a specific repository may span several usecases or just one, if you want to > > avoid multible queries for the > > same entity. My approach to this is to use a PersistenceContext. Every > > usecase may instantiate it's own > > PersistenceContext or may use the PersistenceContext, provided by the > > CallingContext. So i'm able to simply > > control the lifetime of the Repository. Since the views are controlled by > > the usecase they simply use the > > Repository provided by the PersistenceContext. So, if the user wants to > > edit an entity from the list, this > > starts a new usecase with a modal view and an own PersistenceContext. If > > this transaction fails, it has > > nothing to do with the already displayed entity. If is is commited > > succesfully, i just have to refresh the entity in > > the "main" context. I don't know if this is a good approach, but it works > > really nice for me. And since > > informations about NH and WinForms are really rare and even the NHiA book > > doesn' really tell > > something about it, i'll stick to it :-) > > > 2009/8/23 ChrisHolmes <[email protected]> > > >> I am not interested in Castle ActiveRecord. > > >> I'm interested in actually learning how to accomplish my goals. I'll > >> write my own bits to accomplish my tasks, but I need to understand how > >> and why things work, and how they should be done. > > >> I don't have an understanding of HOW to actually manage the NHibernate > >> ISession in a WinForm application. No one cares to explain that. I > >> don't understand how, when I do have an ISession managed, how I use > >> that in something like a Repository, which is code that will live much > >> closer to the DB than a higher level WinForm controller. No one cares > >> to explain that either. > > >> I've read a whole lot of theoretical stuff about session-per- > >> conversation, but no one actually takes any time to describe the how > >> and way and actually show the usage. It's very discouraging. > > >> -Chris > > >> On Aug 22, 12:11 pm, Raul Carlomagno <[email protected]> wrote: > >> > you can try castle activerecord too, it abstracts a little NH Sesion > >> > artifact > > >> > On Aug 22, 1:25 pm, ChrisHolmes <[email protected]> wrote: > > >> > > 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 -~----------~----~----~----~------~----~------~--~---
