Example #1
0
        public void Invoke(ServiceArguments arguments, IDictionary<string, object> routeValues, IRequestCompletion requestCompletion)
        {
            var currentChain = new CurrentChain(_chain, routeValues);
            arguments.Set(typeof(ICurrentChain), currentChain);
            arguments.Set(typeof(IRequestCompletion), requestCompletion);

            if (arguments.Has(typeof (IChainExecutionLog)))
            {
                arguments.Get<IChainExecutionLog>().RootChain = _chain;
            }

            if (_chain.Filters.Any(filter => filter.Filter(arguments) == DoNext.Stop))
            {
                return;
            }

            IActionBehavior behavior = null;

            if (arguments.Has(typeof (IChainExecutionLog)))
            {
                arguments.Get<IChainExecutionLog>().Trace("Building the Behaviors", () =>
                {
                    behavior = _factory.BuildBehavior(arguments, _chain.UniqueId);
                });
            }
            else
            {
                behavior = _factory.BuildBehavior(arguments, _chain.UniqueId);
            }

            
            requestCompletion.WhenCompleteDo(x =>
            {
                var disposable = behavior as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            });

            behavior.Invoke();
        }
Example #2
0
        public void Invoke(ServiceArguments arguments, IDictionary<string, object> routeValues, IRequestCompletion requestCompletion)
        {
            var currentChain = new CurrentChain(_chain, routeValues);
            arguments.Set(typeof(ICurrentChain), currentChain);
            arguments.Set(typeof(IRequestCompletion), requestCompletion);

            if (_chain.Filters.Any(filter => filter.Filter(arguments) == DoNext.Stop))
            {
                return;
            }
            var behavior = _factory.BuildBehavior(arguments, _chain.UniqueId);
            requestCompletion.WhenCompleteDo(x =>
            {
                var disposable = behavior as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            });
            behavior.Invoke();
        }
Example #3
0
        public void Invoke(TypeArguments arguments, IDictionary <string, object> routeValues, IRequestCompletion requestCompletion)
        {
            var currentChain = new CurrentChain(_chain, routeValues);

            arguments.Set(typeof(ICurrentChain), currentChain);
            arguments.Set(typeof(IRequestCompletion), requestCompletion);

            if (arguments.Has(typeof(IChainExecutionLog)))
            {
                arguments.Get <IChainExecutionLog>().RootChain = _chain;
            }

            if (_chain.Filters.Any(filter => filter.Filter(arguments) == DoNext.Stop))
            {
                return;
            }

            IActionBehavior behavior = null;

            if (arguments.Has(typeof(IChainExecutionLog)))
            {
                arguments.Get <IChainExecutionLog>().Trace("Building the Behaviors", () =>
                {
                    behavior = _factory.BuildBehavior(arguments, _chain.UniqueId);
                });
            }
            else
            {
                behavior = _factory.BuildBehavior(arguments, _chain.UniqueId);
            }


            requestCompletion.WhenCompleteDo(x =>
            {
                var disposable = behavior as IDisposable;
                disposable?.Dispose();
            });

            behavior.Invoke();
        }
Example #4
0
        public void Invoke(ServiceArguments arguments, IDictionary <string, object> routeValues, IRequestCompletion requestCompletion)
        {
            var currentChain = new CurrentChain(_chain, routeValues);

            arguments.Set(typeof(ICurrentChain), currentChain);
            arguments.Set(typeof(IRequestCompletion), requestCompletion);

            if (_chain.Filters.Any(filter => filter.Filter(arguments) == DoNext.Stop))
            {
                return;
            }
            var behavior = _factory.BuildBehavior(arguments, _chain.UniqueId);

            requestCompletion.WhenCompleteDo(x =>
            {
                var disposable = behavior as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            });
            behavior.Invoke();
        }
Example #5
0
 public AsyncCoordinator(IRequestCompletion requestCompletion, IEnumerable<IExceptionHandler> exceptionHandlers)
 {
     _requestCompletion = requestCompletion;
     _exceptionHandlers = exceptionHandlers;
     _requestCompletion.TrackRequestCompletionWith(this);
 }
Example #6
0
 public AsyncCoordinator(IRequestCompletion requestCompletion, IEnumerable <IExceptionHandler> exceptionHandlers)
 {
     _requestCompletion = requestCompletion;
     _exceptionHandlers = exceptionHandlers;
     _requestCompletion.TrackRequestCompletionWith(this);
 }