I simply call entity.Save() Something wrong with that?
-Markus 2010/7/29 Dan Jasek <[email protected]>: > The NH lock function is the only method I have found. However, you > don't need to create an ISession to use it. An AR object has access > to the ISession factory holder. I have an abstract base class that > all of my AR classes inherit from. In this class, I define a Reattach > function. > This works fine, as long as you are careful. It will not work if you > are outside an active SessionScope or if the object is already > attached to an active ISession. > > This is what it looks like: > public abstract class BaseModel<T> : ActiveRecordLinqBase<T> > { > public virtual void Reattach() > { > if (!holder.ThreadScopeInfo.HasInitializedScope) > throw new Exception("Cannot reattach if you are not > within a SessionScope."); > holder.CreateSession(typeof(T)).Lock(this, > NHibernate.LockMode.None); > } > } > > -Dan > > On Jul 28, 1:47 pm, Paweł Tarnik <[email protected]> wrote: >> Hi, >> >> Does anyone know how to explicitly attach entity to the current >> session in ActiveRecord? >> >> In pure NHibernate there is ISession.Lock(object, LockMode.None). >> But I can't find anything like that in ActiveRecordMediator, >> SessionScope etc. >> >> Is there any other way than manually create ISession and use it's >> Lock() method? >> >> regards, >> Pawel Tarnik > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" 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/castle-project-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en.
