What is the best place to store the NHibernate session if we only need one?
In the main windows view model?
In the app? In the DataAcc开发者_如何学运维ess Class?You should read Oren Eini's MSDN article on Building a Desktop To-Do application with NHibernate. He goes into detail about creating and managing the lifetime of an NHibernate session, as well as two-way databinding and propagating entity changes.
I believe he's using some variant of MVP or MVVM in his examples, though he doesn't mention it by name.
精彩评论