tags:

views:

135

answers:

0

I am trying to save entity data into separate table (serialized as a collection of key-value pairs). Seams that I cannot use BeginTransaction and Commit because I am getting NHibernate ERROR "Possible nonthreadsafe access to session"

I am not an expert of of NHib but suppose the problem is that there is already some transaction started for @event.Entity object.

I am not sure if I was clear enough so here is a part of the implementation of OnPreUpdate method of IPreUpdateEventListener.

public bool OnPreUpdate(PreUpdateEvent @event)
{
VersionInfo version = new VersionInfo()
IVersioned versioned = @event.Entity as IVersioned

// foreach to loop through property names of entity and add them to collection
...
_versioningService.Save(); // this is where it breaks since this Save method has BeginTransaction and Commit to save VersionInfo object
}