Exemplo n.º 1
0
        static ExplicitArguments CreateActivatorArguments(QueryMiddleware <TArgs, TResult> next, object[] args)
        {
            var expArgs = new ExplicitArguments();

            expArgs.Set(next);
            foreach (var arg in args)
            {
                expArgs.Set(arg.GetType(), arg);
            }
            return(expArgs);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建查询链
        /// </summary>
        public void BuildChain()
        {
            headMiddleware = null;
            var reversedParams = Enumerable.Reverse(middlewareParams);
            QueryMiddleware <TArgs, TResult> lastMiddleware = null;

            foreach (var param in reversedParams)
            {
                var expArgs    = CreateActivatorArguments(lastMiddleware, param.Item2);
                var middleware = (QueryMiddleware <TArgs, TResult>)ServiceLocator.Default.IoC.GetInstance(param.Item1, expArgs);
                lastMiddleware = middleware;
            }
            headMiddleware = lastMiddleware;
            chainUpdated   = true;
        }
Exemplo n.º 3
0
 public QueryMiddleware(QueryMiddleware <TArgs, TResult> next)
 {
     Next = next;
 }