public static IUnitOfWork Start(UnitOfWorkOption unitOfWorkOption) { if (!Enum.IsDefined(typeof(UnitOfWorkOption), unitOfWorkOption)) throw new InvalidEnumArgumentException(nameof(unitOfWorkOption), (int)unitOfWorkOption, typeof(UnitOfWorkOption)); //IUnitOfWorkFactory factory = IContainerAdapter.GetInstance<IUnitOfWorkFactory>(); IUnitOfWorkFactory factory = UnitOfWorkFactory.Instance; return factory.Create(unitOfWorkOption); }
public IUnitOfWork Create(UnitOfWorkOption unitOfWorkOption = UnitOfWorkOption.Reuse) { IUnitOfWork previousUnitOfWork = this.Current; if (unitOfWorkOption == UnitOfWorkOption.Reuse && previousUnitOfWork != null) { return previousUnitOfWork; } INestableUnitOfWork newUnitOfWork = InternalCreate(previousUnitOfWork); this.Current = newUnitOfWork; return newUnitOfWork; }
public IUnitOfWork Create(UnitOfWorkOption unitOfWorkOption = UnitOfWorkOption.Reuse) { IUnitOfWork previousUnitOfWork = this.Current; if (unitOfWorkOption == UnitOfWorkOption.Reuse && previousUnitOfWork != null) { return(previousUnitOfWork); } INestableUnitOfWork newUnitOfWork = InternalCreate(previousUnitOfWork); this.Current = newUnitOfWork; return(newUnitOfWork); }
public IUnitOfWork Create(UnitOfWorkOption unitOfWorkOption) { if (!Enum.IsDefined(typeof(UnitOfWorkOption), unitOfWorkOption)) throw new InvalidEnumArgumentException(nameof(unitOfWorkOption), (int)unitOfWorkOption, typeof(UnitOfWorkOption)); IUnitOfWork previousUnitOfWork = this.Current; if (unitOfWorkOption == UnitOfWorkOption.Reuse && previousUnitOfWork != null) { return previousUnitOfWork; } INestableUnitOfWork newUnitOfWork = InternalCreate(previousUnitOfWork); this.Current = newUnitOfWork; return newUnitOfWork; }
public UnitOfWork(UnitOfWorkOption option) { list = new List<OperatorInfo>(); Maplist = new List<Map>(); this.isShadow = false; this.Option = option; if (this.Option == UnitOfWorkOption.Required) { UnitOfWork currentUnitOfWork = GetCurrentUnitOfWork(); if (currentUnitOfWork == null) { this.list = new List<OperatorInfo>(); } else { this.list = currentUnitOfWork.list; this.isShadow = true; } } UnitOfWorkStack.Push(this); }
public UnitOfWork(UnitOfWorkOption option) { _list = new List <OperatorInfo>(); _maplist = new List <Map>(); _isShadow = false; Option = option; if (Option == UnitOfWorkOption.Required) { var currentUnitOfWork = GetCurrentUnitOfWork(); if (currentUnitOfWork == null) { _list = new List <OperatorInfo>(); } else { _list = currentUnitOfWork._list; _isShadow = true; } } UnitOfWorkStack.Push(this); }
public UnitOfWork(UnitOfWorkOption option) { list = new List <OperatorInfo>(); Maplist = new List <Map>(); this.isShadow = false; this.Option = option; if (this.Option == UnitOfWorkOption.Required) { UnitOfWork currentUnitOfWork = GetCurrentUnitOfWork(); if (currentUnitOfWork == null) { this.list = new List <OperatorInfo>(); } else { this.list = currentUnitOfWork.list; this.isShadow = true; } } UnitOfWorkStack.Push(this); }
public override void Begin(UnitOfWorkOption options) { if (options?.IsTransactional != true) { return; } var transactionOptions = new TransactionOptions { IsolationLevel = (IsolationLevel)options?.IsolationLevel.GetValueOrDefault(IsolationLevel.ReadUncommitted), }; if (options?.Timeout != null) { transactionOptions.Timeout = options.Timeout.Value; } CurrentTransaction = new TransactionScope( (TransactionScopeOption)options?.Scope.GetValueOrDefault(TransactionScopeOption.Required), transactionOptions, (TransactionScopeAsyncFlowOption)options?.AsyncFlowOption.GetValueOrDefault(TransactionScopeAsyncFlowOption.Enabled) ); Begin(); }
public static IUnitOfWork Start(UnitOfWorkOption unitOfWorkOption = UnitOfWorkOption.Reuse) { IUnitOfWorkFactory factory = IoC.GetInstance<IUnitOfWorkFactory>(); return factory.Create(unitOfWorkOption); }
public static IUnitOfWork Start(UnitOfWorkOption unitOfWorkOption = UnitOfWorkOption.Reuse) { IUnitOfWorkFactory factory = IoC.GetInstance <IUnitOfWorkFactory>(); return(factory.Create(unitOfWorkOption)); }