Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The WcfOperationSessionContext, similar to ThreadStaticSessionContext and WebRequestSessionContext is an implementation for a session context. The session context is used to bind (associate) a ISession instance to a particular context.</p> <p>The session in the current context can be retrieved by calling ISessionFactory.GetCurrentSession().</p> <p>You can find more information about <a href="http://nhforge.org/wikis/reference2-0en/context-sessions.aspx" rel="noreferrer">session context here</a>.</p> <p>The WcfOperationSessionContext represents a context that spans for the entire duration of a WCF operation. You still need to handle the binding of the session in the begining of the operation and the unbinding/commiting/disposal of the session at the end of the operation.</p> <p>To get access to the begin/end actions in the wcf pipeline you need to implement a IDispatchMessageInspector. You can see a sample <a href="https://gist.github.com/881356" rel="noreferrer">here</a>.</p> <p>Also regarding WCF integration: if you use ThreadStatic session context it will appear to work on development, but you will hit the wall in production when various components (ex: authorization, authentication ) from the wcf pipeline are executed on different threads.</p> <p>As for best practices you almost nailed it: Use WcfOperationSessionContext to store the current session and the IDispatchMessageInspector to begin/complete your unit of work.</p> <p><strong>EDIT - to address the details you added</strong>: If you configured WcfOperationSessionContext and do the binding/unbinding as i explained above, all you have to do to is inject the ISessionFactory into your service and just use factory.GetCurrentSession(). I'll post a sample prj if time permits.</p> <p>Here is the <a href="https://github.com/etishor/WCF-Ioc-Nhibernate-Sample" rel="noreferrer">sample project</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload