Example #1
0
        public static Type GetCommandHandlerType(this CqrsInfo info)
        {
            if (!info.IsCommand)
            {
                return(null);
            }

            if (info.IsAsync)
            {
                if (info.RspType != null)
                {
                    return(typeof(IAsyncCommandHandler <,>).MakeGenericType(info.ReqType, info.RspType));
                }
                else
                {
                    return(typeof(IAsyncCommandHandler <>).MakeGenericType(info.ReqType));
                }
            }
            else
            {
                if (info.RspType != null)
                {
                    return(typeof(ICommandHandler <,>).MakeGenericType(info.ReqType, info.RspType));
                }
                else
                {
                    return(typeof(ICommandHandler <>).MakeGenericType(info.ReqType));
                }
            }
        }
Example #2
0
        public static Type GetHandlerType(this CqrsInfo info)
        {
            if (info.IsQuery)
            {
                return(info.GetQueryHandlerType());
            }

            if (info.IsCommand)
            {
                return(info.GetCommandHandlerType());
            }

            return(null);
        }
Example #3
0
        public static Type GetQueryHandlerType(this CqrsInfo info)
        {
            if (!info.IsQuery)
            {
                return(null);
            }

            if (info.IsAsync)
            {
                return(typeof(IAsyncQueryHandler <,>).MakeGenericType(info.ReqType, info.RspType));
            }
            else
            {
                return(typeof(IQueryHandler <,>).MakeGenericType(info.ReqType, info.RspType));
            }
        }