public static void Saga <T>(this IReceiveEndpointConfigurator configurator, Container container, Action <ISagaConfigurator <T> > configure = null) where T : class, ISaga { var repository = container.GetInstance <ISagaRepository <T> >(); var scopeProvider = new SimpleInjectorSagaScopeProvider <T>(container); var sagaRepository = new ScopeSagaRepository <T>(repository, scopeProvider); configurator.Saga(sagaRepository, configure); }
public ISagaRepository <T> CreateSagaRepository <T>(Action <ConsumeContext> scopeAction) where T : class, ISaga { var repository = _container.GetInstance <ISagaRepository <T> >(); var scopeProvider = new SimpleInjectorSagaScopeProvider <T>(_container); if (scopeAction != null) { scopeProvider.AddScopeAction(scopeAction); } return(new ScopeSagaRepository <T>(repository, scopeProvider)); }