Exemplo n.º 1
0
        ISagaState GetSagaStateFromCustom(IEvent evnt, IResolveDependencies resolver)
        {
            var evntType = evnt.GetType();
            dynamic repo =
                resolver.ResolveOptional(typeof(IFindSagaState<>.Using<>).MakeGenericType(SagaStateType, evntType));
            if (repo == null)
            {
                return null;
            }

            string fullName = repo.GetType().FullName;
            this.LogDebug($"Using saga repository '{fullName}' ...");
            return repo.GetSagaData((dynamic) evnt);
        }
Exemplo n.º 2
0
        ISagaState GetSagaStateFromCustom(IEvent evnt, IResolveDependencies resolver)
        {
            var     evntType = evnt.GetType();
            dynamic repo     =
                resolver.ResolveOptional(typeof(IFindSagaState <> .Using <>).MakeGenericType(SagaStateType, evntType));

            if (repo == null)
            {
                return(null);
            }

            string fullName = repo.GetType().FullName;

            this.LogDebug($"Using saga repository '{fullName}' ...");
            return(repo.GetSagaData((dynamic)evnt));
        }
Exemplo n.º 3
0
        private bool SaveSagaToCustom(dynamic saga, IResolveDependencies resolver, bool isNew)
        {
            dynamic repo = resolver.ResolveOptional(typeof(ISaveSagaState <>).MakeGenericType(SagaStateType));

            this.LogDebug("Saving saga {0} ...", SagaStateType.Name);

            if (repo == null)
            {
                return(false);
            }

            string fullName = repo.GetType().FullName;

            this.LogDebug("Using repository '{0}'", fullName);
            repo.Save(saga, isNew);
            return(true);
        }
Exemplo n.º 4
0
        private bool SaveSagaToCustom(dynamic saga, IResolveDependencies resolver, bool isNew)
        {
            dynamic repo = resolver.ResolveOptional(typeof (ISaveSagaState<>).MakeGenericType(SagaStateType));

            this.LogDebug("Saving saga {0} ...", SagaStateType.Name);

            if (repo == null) return false;

            string fullName = repo.GetType().FullName;
            this.LogDebug("Using repository '{0}'", fullName);
            repo.Save(saga, isNew);
            return true;
        }