コード例 #1
0
        public static TSaga ContainsInState <TSaga>(this ISagaList <TSaga> sagas, Guid sagaId, SagaStateMachine <TSaga> machine, State state)
            where TSaga : class, SagaStateMachineInstance
        {
            bool any = sagas.Select(x => x.CorrelationId == sagaId && machine.GetState(x).Result.Equals(state)).Any();

            return(any ? sagas.Contains(sagaId) : null);
        }
コード例 #2
0
        public static T ContainsInState <T>(this ISagaList <T> sagas, Guid correlationId, SagaStateMachine <T> machine, State state)
            where T : class, SagaStateMachineInstance
        {
            Func <T, bool> filter = machine.CreateSagaFilter(x => x.CorrelationId == correlationId, state);

            var any = sagas.Select(x => filter(x)).Any();

            return(any ? sagas.Contains(correlationId) : null);
        }
コード例 #3
0
        public static TInstance ContainsInState <TStateMachine, TInstance>(this ISagaList <TInstance> sagas, Guid correlationId, TStateMachine machine,
                                                                           Func <TStateMachine, State> stateSelector)
            where TStateMachine : SagaStateMachine <TInstance>
            where TInstance : class, SagaStateMachineInstance
        {
            var state = stateSelector(machine);

            return(ContainsInState(sagas, correlationId, machine, state));
        }