Exemplo n.º 1
0
        static ISagaRepository <TInstance> CreateSagaRepository <TInstance>(IContainer scope, Action <ConsumeContext> configureScope)
            where TInstance : class, SagaStateMachineInstance
        {
            ISagaRepositoryFactory repositoryFactory = new LamarSagaRepositoryFactory(scope, configureScope);

            return(repositoryFactory.CreateSagaRepository <TInstance>(AddStateMachineActivityFactory));
        }
Exemplo n.º 2
0
        static ISagaRepository <TInstance> GetSagaRepository <TInstance>(IContainer container, Action <ConsumeContext> configureScope = null)
            where TInstance : class, ISaga
        {
            ISagaRepositoryFactory repositoryFactory = new LamarSagaRepositoryFactory(container);

            return(repositoryFactory.CreateSagaRepository <TInstance>(configureScope));
        }
        /// <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="container"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static void Saga <T>(this IReceiveEndpointConfigurator configurator, IContainer container, Action <ISagaConfigurator <T> > configure = null)
            where T : class, ISaga
        {
            ISagaRepositoryFactory factory = new LamarSagaRepositoryFactory(container);

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

            configurator.Saga(sagaRepository, configure);
        }