another thought. Session contains/is an identity map. which is also
referred to as 1st level cache. there is only 1 instance of a given
entity in session.
this means there are not multiple instances of the same entity in the
session. so if the user has 2 screens using the same session showing
the same entity. the reference is the same.

Oren (Ayende) just had an article published in MSDN magazine about NH
session management on a desktop application. One approach (of many) is
a session per form. This may be better suited to your scenario. here
is the article (http://msdn.microsoft.com/en-us/magazine/
ee819139.aspx).

On Dec 16, 8:39 am, DanV <[email protected]> wrote:
> Hi,
>
> I'm involved in a project where I have a very particular scenario that
> made me initially decide to use only one session per application.
> Because of that, when I try to persist an entity in the database all
> other entities that changed are also persisted (by flushing the
> session).
>
> These are the facts and unfortunately (for me :)) some are not under
> my control:
> - 2 tier MDI app , developed over WPF.
> - data binding is used bind entities to controls in windows. This
> means that the entity is changed as the user operates in the GUI.
> Canceling is done by reloading the entity.
> - lazy loading is used so the session cannot just be closed.
> - and the worst, entities and app windows are not hard coded but
> generated based on a model (let's say a sort of UML). This means that
> I don't have control over what and how is presented in the interface
> or how entities are related.
> - I cannot open a session for each window since there can be 2 windows
> presenting somehow the same collection and that is not possible in
> NH.
> - I cannot use a separate new session to save an entity also because
> NH does not allow same collection associated in 2 opened sessions.
>
> Problem:
> - There can be a scenario where an user can open 2 windows, make
> changes in both of them but incomplete/inconsistent in one of them and
> hit save on the other where changes are complete.. Having only one
> session means that all changes will be (or at least try to be) written
> in db during Flush and for me that will be a problem in this
> particular scenario :).
>
> Question:
> -Is there any way to persist ony one entity (and whatever is cascading
> with it of course) out of all entities cached in an ISession, while
> the session is opened?

--

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