示例#1
0
        /// <summary>
        /// 启动一个无状态的工作单元
        /// </summary>
        /// <returns></returns>
        public static INhibernateUnitOfWork StartStateless()
        {
            if (CurrentUnitOfWork != null)
            {
                throw new InvalidOperationException("You cannot start more than one unit of work at the same time.");
            }

            var unitOfWork = mUnitOfWorkFactory.Create(false);

            CurrentUnitOfWork = unitOfWork;
            return(unitOfWork);
        }
示例#2
0
 /// <summary>
 /// 释放工作单元
 /// </summary>
 /// <param name="adapter"></param>
 public static void DisposeUnitOfWork(INhibernateUnitOfWork adapter)
 {
     CurrentUnitOfWork = null;
 }
示例#3
0
 void IUnitOfWorkFactory.DisposeUnitOfWork(INhibernateUnitOfWork adapter)
 {
     this.DisposeUnitOfWork(adapter);
 }
示例#4
0
 public NHRepository(INhibernateUnitOfWork nhunitofwork, ISession session)
 {
     NHUnitOfWork    = nhunitofwork;
     _currentSession = session;
 }
示例#5
0
 public void DisposeUnitOfWork(INhibernateUnitOfWork adapter)
 {
     CurrentSession = null;
     UnitOfWork.DisposeUnitOfWork(adapter);
 }