Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        public void Begin(UnitOfWorkOptions options)
        {
            if(options ==null)
                throw new ArgumentNullException("options");

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