Thanks - that's useful, I'll clean up the request code.  Perhaps it's just
the way it managed the objects, but it doesn't explain the 30MB of unmanaged
memory - this I can't profile.  Any clue what this could be?

*
*
  *Paul Allington [image: See my
profile]<http://www.intelligentpenguin.co.uk/about/theteam/paul>
*
*T:* 01799 522 665
*M:* 07973 145 754
*E:* [email protected]
*W:* www.intelligentpenguin.co.uk
*W:* www.creative-penguin.co.uk
 [image: Intelligent Penguin] <http://www.intelligentpenguin.co.uk>  For
highly creative & technically brilliant websites, and on-line management
systems
------------------------------------------------------------------------------
 My
profiles: [image: Facebook] <http://www.facebook.com/paulallington>[image:
LinkedIn] <http://uk.linkedin.com/in/paulallington>[image:
Twitter]<http://twitter.com/paulallington>
Contact me: [image: Google Talk/]phallington [image:
Skype/]paul-allington [image:
Y! messenger/]paul_allington




On Wed, Feb 9, 2011 at 9:05 PM, Jason Meckley <[email protected]>wrote:

> I think the problem is your transaction management in end request. rollback
> if error (good) else flush session (bad). call transaction.commit() instead
> and dispose of the transaction.
>
> some things to consider:
> 1. sessions are cheap so just create one for each request and dispose when
> the request ends.
> 2. all NH actions should be wrapped in a transaction if every request will
> require db access begin/end the transaction with the session. if not all WCF
> calls require NH, than manage the transaction with a decorator around the
> WCF call (similar to Filters in MVC frameworks)
>
> I would start by cleaning up the module code
>
> //begin request
> var session = SessionFactory.OpenSession();
> session.BeginTransaction();
> ManagedWebSessionContext.Bind(HttpContext.Current, session);
>
> //end request
> var session = ManagedWebSessionContext.Unbind(HttpContext.Current,
> SessionFactory);
> using(session)
> {
>    using(var tx = session.Transaction)
>    {
>        if(Server.LastException == null)
>        {
>             tx.Commit();
>        }
>        else
>        {
>            tx.Rollback();
>        }
>    }
> }
>
> that's it. now if you want to manage the transaction per WCF action then
> the module would only manage the session
> //begin request
>
> ManagedWebSessionContext.Bind(HttpContext.Current,
> SessionFactory.OpenSession());
>
> //end request
> ManagedWebSessionContext.Unbind(HttpContext.Current,
> SessionFactory).Dispose();
>
> and a WCF decorator would manage the transaction. something like
> //decorator... wcfservice is the original/base implementation
> using(var txt = SessionFactory.GetCurrentSession().BeginTransaction())
> {
>     try
>     {
>         wcfservice.Proceed();
>         tx.Commit();
>     }
>     catch
>     {
>           tx.Rollback();
>           throw;
>     }
> }
>
> --
> 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.
>

-- 
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