ISagaRepository <T> ISagaRepositoryFactory.CreateSagaRepository <T>()
        {
            var repository = _scopeProvider.LifetimeScope.Resolve <ISagaRepository <T> >();

            var scopeProvider = new AutofacSagaScopeProvider <T>(_scopeProvider, _name);

            scopeProvider.AddScopeAction(x => x.GetOrAddPayload <IStateMachineActivityFactory>(() => new AutofacStateMachineActivityFactory()));

            return(new ScopeSagaRepository <T>(repository, scopeProvider));
        }
Esempio n. 2
0
        ISagaRepository <T> ISagaRepositoryFactory.CreateSagaRepository <T>(Action <ConsumeContext> scopeAction)
        {
            var repository = _scopeProvider.LifetimeScope.Resolve <ISagaRepository <T> >();

            var scopeProvider = new AutofacSagaScopeProvider <T>(_scopeProvider, _name, _configureScope);

            if (scopeAction != null)
            {
                scopeProvider.AddScopeAction(scopeAction);
            }

            return(new ScopeSagaRepository <T>(repository, scopeProvider));
        }