1-You can just the Id from the Browse Product presenter to the Edit Product. 2-You can share the same session. If you are using unhaddins, you can use model per use case, maybe your use case involve browse and edit.. Then you will have a Model named ProductsAdministrationService. Recently I figure out that this is called in DDD, "Application Service". You can see an example in my Chinook Media Manager, is WPF but this artifact is equal in winforms:
http://code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAddIns.Examples.WPF/ChinookMediaManager.Domain.Impl/AlbumManagerModel.cs <http://code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAddIns.Examples.WPF/ChinookMediaManager.Domain.Impl/AlbumManagerModel.cs>Recently, I figure out that having browse and edit in the same conversation is not so good. So, I will recomend you the former solution, share Ids... 2009/12/21 Broken Pipe <[email protected]> > First, guys i would like to thank you for answering my previous post > about "Session Management". Information you gave was really helpful. > Now i need help on related problem.. so > > Situation: I have a WinForms app with MVP pattern applied, and i have > 2 simple Views in it: > 1) Showing Product list (lets call it "List View"), > 2) Edit\Add Product View (lets call it "Editor View") > I'm using Session-Per-Presenter pattern in this App. > > The Problem: I can't update entities passed from one presenter to > another, as you may guess I'm getting "Illegal attempt to associate a > collection with two open sessions" Exception. > > Well you can say that this is Session management problem, but i will > disagree with you, it's my MVP implementation problem. (You may wonder > why I'm posting this question here then, well i don't know other > places where someone use Nhibernate with MVP, and you have nice > examples in uNhAddIns) > > The problem is how i pass Product which need to be edited to Editor > View: > I'm currently do it like this: > void EditProductClicked(object sender, EventArgs e) > { > IProductEditorView EditorView = > IoC.Get<IProductEditorView>(); > EditorView.Product = > Model.GetRepository<Product>().SingleBy(t => > t.id == View.CurrentProduct.id); > //I can do EditorView.Product = View.CurrentProduct but the > result > will be the same anyway this entity is loaded in this presetner and > ISession > IoC.Get<IViewManager>().ActivateView<IProductEditorView> > (IProductEditorView); > } > > How to pass data between Views? I read lots of materials on MVP (All > blog's i could find, book "Architecting Microsoft® .NET Solutions for > the Enterprise" there is whole chapter on MVP there, but no where i > could find info about MVP triad communication, the only article that > tries to cover this topic somehow is "Humble Dialog Box V2" but even > there author don't pass data from main view to child view. (i was very > disappointed about it) > > I understand my problem but i can't find good way to solve it. > I don't want to expose Presenters to other Presenters, ie i don't want > to do: > IoC.Get<IProductEditorView>().Presenter.SetProduct > (View.CurrentProduct) //and load this product on other side from > Model. > > I would appreciate any help, I'm struggling with MVP+NHibernate for > more then 170 hours already. > > -- > > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > > -- 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.
