void global::NHibernate.IInterceptor.SetSession(global::NHibernate.ISession session) { foreach (var item in _interceptors) { item.Value.SetSession(session); } }
public NhProviderTransaction(global::NHibernate.ISession nhSession, bool isNestedInActiveTransaction = false) { _nhSession = nhSession; _isNestedInActiveTransaction = isNestedInActiveTransaction; //_nhTransaction = nhSession.Transaction; IncrementNestingLevel(); if (!isNestedInActiveTransaction) { _nhTransaction = nhSession.BeginTransaction(); } else { _nhTransaction = nhSession.Transaction; } LogHelper.TraceIfEnabled <NhProviderTransaction>("Constructing transaction {0} on instance {1}", () => _nhTransaction.GetHashCode(), () => GetHashCode()); //if (isNestedInActiveTransaction) //{ // _nhTransaction = NhSession.BeginTransaction(System.Data.IsolationLevel.RepeatableRead); //} //else //{ // _nhTransaction = NhSession.Transaction; //} Begin(); }
public virtual void SaveOrUpdateTo(global::NHibernate.ISession session) { if (session == null) { throw new ArgumentNullException("session"); } switch (this.ObjectState) { case DataObjectState.New: Zetbox.API.Utils.Logging.Log.DebugFormat("Save: {0}#{1}", this.GetType(), this.ID); session.Save(this.NHibernateProxy); break; case DataObjectState.Modified: case DataObjectState.Unmodified: Zetbox.API.Utils.Logging.Log.DebugFormat("SaveOrUpdate: {0}#{1}", this.GetType(), this.ID); // according to NH Documentation this is not needed // session.SaveOrUpdate(this.NHibernateProxy); break; case DataObjectState.Deleted: throw new InvalidOperationException("object should be deleted, not saved"); case DataObjectState.NotDeserialized: throw new InvalidOperationException("object not deserialized"); default: throw new NotImplementedException(String.Format("unknown DataObjectState encountered: '{0}'", this.ObjectState)); } }
public void FixtureSetup() { var provider = new NHibernateProvider(); _config = provider.CreateConfiguration(); _sessionFactory = provider.CreateSessionFactory(_config); _session = _sessionFactory.OpenSession(); provider.ExportSchema(_config, _session.Connection); using (var trans = _session.BeginTransaction()) { var modelCreator = new NHibernateQueryingModel(); modelCreator.CreateModel(_session); trans.Commit(); } _query = new QueryAdapter(_session); QueryableExtensions.EagerFetchingProvider = new EagerFetchingProvider(); QueryableExtensions.LazyQueryingProvider = new LazyResultProvider(); QueryableExtensions.AsyncQueryingProvider = new AsyncQueryProvider(); }
public Database(ISession session) { Check.Argument.IsNotNull(session, "session"); this.session = session; transientEntities = new List <IEntity>(); }
public NhProviderTransaction(global::NHibernate.ISession nhSession, bool isNestedInActiveTransaction = false) { _nhSession = nhSession; _isNestedInActiveTransaction = isNestedInActiveTransaction; IncrementNestingLevel(); }
/// <summary> /// Occurs before the action method is invoked. /// </summary> /// <param name="actionContext">The action context.</param> public override void OnActionExecuting(HttpActionContext actionContext) { base.OnActionExecuting(actionContext); global::NHibernate.ISession session = NHibernateSession.CurrentFor(this.GetEffectiveFactoryKey()); if (this.IsolationLevel != IsolationLevel.Unspecified) { session.BeginTransaction(this.IsolationLevel); } else { session.BeginTransaction(); } }
private void CaptureDomainEvents(global::NHibernate.ISession session) { var sessionImplementation = session.GetSessionImplementation(); var aggregateRoots = sessionImplementation.PersistenceContext.EntityEntries.Keys .OfType <AggregateRoot>(); foreach (var aggregateRoot in aggregateRoots.ToList()) { while (aggregateRoot.TryDequeueDomainEvent(out var e)) { this.DomainEvents.Add(e); } } }
protected DomainEventEmittingDecorator(global::NHibernate.ISession session, IMediator mediator) { this.session = session; this.mediator = mediator; }
/// <summary> /// Gets a persistence test builder using a specified session instance. The session will not be disposed at /// the end of the test. /// </summary> /// <returns>The persistence test builder.</returns> /// <param name="session">The session.</param> public static PersistenceTestBuilder UsingSession(global::NHibernate.ISession session) { var sessionProvider = new SessionProvider(() => new SessionAdapter(session), false); return(new PersistenceTestBuilder(sessionProvider)); }
public NHibernateSession(global::NHibernate.ISession session) { this.session = session; }
public void SetSession(global::NHibernate.ISession session) { throw new NotImplementedException(); }
public NHibernateTransactionScopeDecorator(IHandler <TCommand, TResult> innerHandler, global::NHibernate.ISession session) { this.innerHandler = innerHandler; this.session = session; }
#pragma warning disable 1591 public IUnitOfWork Create(IsolationLevel isolationLevel) { global::NHibernate.ISession session = _sessionProvider.GetSessionForUoW(); return(new NHibernateUnitOfWork(session, isolationLevel)); }
public NHibernateStatefulTransaction(global::NHibernate.ITransaction adapted, global::NHibernate.ISession session) : base(adapted) { this.session = session; }
public NHibernateStatefulTransaction(global::NHibernate.ITransaction adapted, global::NHibernate.ISession session) : base(adapted) { this.session = session; }
public Database(ISession session) { this.session = session; transientEntities = new List <IEntity>(); }