Ejemplo n.º 1
0
        private Type GetControllerTypeForQuery(CqrsInfo info)
        {
            bool inputParams = info.ReqType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.SetProperty).Any();

            if (info.IsAsync)
            {
                if (inputParams)
                {
                    return(typeof(QueryControllerAsyncBase <, ,>).MakeGenericType(info.ReqType, info.GetHandlerType(), info.RspType));
                }
                else
                {
                    return(typeof(QueryControllerVoidAsyncBase <, ,>).MakeGenericType(info.ReqType, info.GetHandlerType(), info.RspType));
                }
            }
            else
            {
                if (inputParams)
                {
                    return(typeof(QueryControllerBase <, ,>).MakeGenericType(info.ReqType, info.GetHandlerType(), info.RspType));
                }
                else
                {
                    return(typeof(QueryControllerVoidBase <, ,>).MakeGenericType(info.ReqType, info.GetHandlerType(), info.RspType));
                }
            }
        }
Ejemplo n.º 2
0
 private Type GetControllerTypeForCommand(CqrsInfo info)
 {
     if (info.IsAsync)
     {
         if (info.RspType == null)
         {
             return(typeof(CommandControllerAsyncBase <,>).MakeGenericType(info.ReqType, info.GetHandlerType()));
         }
         else
         {
             return(typeof(CommandControllerAsyncReturnBase <, ,>).MakeGenericType(info.ReqType, info.GetHandlerType(), info.RspType));
         }
     }
     else
     {
         if (info.RspType == null)
         {
             return(typeof(CommandControllerBase <,>).MakeGenericType(info.ReqType, info.GetHandlerType()));
         }
         else
         {
             return(typeof(CommandControllerReturnBase <, ,>).MakeGenericType(info.ReqType, info.GetHandlerType(), info.RspType));
         }
     }
 }