Is this ISession handled by the SessionScope - Castle ActiveRecord

Posted by oillio on Stack Overflow See other posts from Stack Overflow or by oillio
Published on 2010-05-28T02:56:12Z Indexed on 2010/05/28 3:01 UTC
Read the original article Hit count: 247

Filed under:

Can I do this?
I have the following in my code:

public class ARClass : ActiveRecordBase<ARClass>
{
      ---SNIP---

    public void DoStuff()
    {
        using (new SessionScope())
        {
            holder.CreateSession(typeof(ARClass)).Lock(this, LockMode.None);
            ...Do some work...
        }
    }
}

So, as I'm sure you can guess, I am doing this so that I can access lazy loaded references in the object. It works great, however I am worried about creating an ISession like this and just dropping it. Does it get properly registered with the SessionScope and will the scope properly tare my ISession down when it is disposed of? Or do I need to do more to manage it myself?

© Stack Overflow or respective owner

Related posts about castle-activerecord