static ISagaRepository <TInstance> CreateSagaRepository <TInstance>(IServiceProvider serviceProvider)
            where TInstance : class, SagaStateMachineInstance
        {
            ISagaRepositoryFactory repositoryFactory = new DependencyInjectionSagaRepositoryFactory(serviceProvider);

            return(repositoryFactory.CreateSagaRepository <TInstance>(AddStateMachineActivityFactory));
        }
示例#2
0
        static ISagaRepository <TInstance> CreateSagaRepository <TInstance>(IServiceProvider provider)
            where TInstance : class, ISaga
        {
            ISagaRepositoryFactory repositoryFactory = new DependencyInjectionSagaRepositoryFactory(provider);

            return(repositoryFactory.CreateSagaRepository <TInstance>());
        }
        /// <summary>
        /// Registers a saga using the container that has the repository resolved from the container
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="configurator"></param>
        /// <param name="provider"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IServiceProvider provider, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            ISagaRepositoryFactory factory = new DependencyInjectionSagaRepositoryFactory(provider);

            ISagaRepository <T> sagaRepository = factory.CreateSagaRepository <T>();

            configurator.Saga(sagaRepository, configure);
        }