NSoft.NFramework.Data.NHibernateEx.ForTesting.UnitOfWorkTestContext.CreateNestedUnitOfWork C# (CSharp) Method

CreateNestedUnitOfWork() public method

Starts a nested UnitOfWork
public CreateNestedUnitOfWork ( ) : IUnitOfWork
return IUnitOfWork
        public IUnitOfWork CreateNestedUnitOfWork() {
            Guard.Assert(_unitOfWorkNestingLevel != -1, "부모 UnitOfWork가 존재하지 않습니다. 먼저 CreateUnitOfWork()를 호출하셔야 합니다.");

            //if(_unitOfWorkNestingLevel == -1)
            //    throw new InvalidOperationException("previous unit of work does not exist. first of all you need to call CreateUnitOfWork()");

            var uow = UnitOfWork.Start(UnitOfWork.CurrentSession.Connection,
                                       UnitOfWorkNestingOptions.CreateNewOrNestUnitOfWork);
            _unitOfWorkNestingLevel++;
            return uow;
        }