public IUnitOfWorkCompleteHandle Begin(UnitOfWorkOptions options) { var outerUow = _currentUnitOfWorkProvider.Current; if (options.Scope == TransactionScopeOption.Required && outerUow != null) { return(new InnerUnitOfWorkCompleteHandle()); } var uow = _serviceProvider.GetService <IUnitOfWork>(); uow.Completed += (sender, args) => { _currentUnitOfWorkProvider.Current = null; }; uow.Failed += (sender, args) => { _currentUnitOfWorkProvider.Current = null; }; uow.Disposed += (sender, args) => { uow.Dispose(); }; uow.Begin(options); // Inherit connectionStringName from outer UOW if (outerUow != null) { uow.SetConnectionStringName(outerUow.GetConnectionStringName()); } _currentUnitOfWorkProvider.Current = uow; return(uow); }
/// <inheritdoc/> public virtual void InitOptions(UnitOfWorkOptions options) { Options = options; }
public void InitOptions(UnitOfWorkOptions options) { this.Options = options; }