public IUnitOfWorkCompleteHandle Begin(UnitOfWorkOptions options)
        {
            options.FillDefaultsForNonProvidedOptions(_defaultOptions);

            if (options.Scope == TransactionScopeOption.Required && _currentUnitOfWorkProvider.Current != null)
            {
                return new DefaultUnitOfWorkCompleteHandle();
            }
            var uow = _iocResolver.Resolve<IUnitOfWork>();

            uow.Completed += (sender, args) =>
            {
                _currentUnitOfWorkProvider.Current = null;
            };

            uow.Failed += (sender, args) =>
            {
                _currentUnitOfWorkProvider.Current = null;
            };

            uow.Disposed += (sender, args) => _iocResolver.Release(uow);

            uow.Begin(options);
            _currentUnitOfWorkProvider.Current = uow;

            return uow;
        }
Exemple #2
0
        public void Begin(UnitOfWorkOptions options)
        {
            if(options ==null)
                throw new ArgumentNullException("options");

            PreventMultipleBegin();
            Options = options;
            SetFilters(options.FilterOverrides);
            
            BeginUow();
        }