コード例 #1
0
        public Responses.Query <Responses.Paged <TResponse> > Process <TResponse>(PagedQuery <TResponse> query)
        {
            var handlerType = typeof(IPagingQueryHandler <,>).MakeGenericType(query.GetType(), typeof(TResponse));

            dynamic handler = this._container.GetInstance(handlerType);

            return(handler.Handle((dynamic)query));
        }
コード例 #2
0
        public Boolean Satisfied <TResponse>(PagedQuery <TResponse> query, TResponse dto)
        {
            var handlerType = typeof(IPagingQueryHandler <,>).MakeGenericType(query.GetType(), typeof(TResponse));

            dynamic handler = _container.GetInstance(handlerType);

            return(handler.Satisfied((dynamic)query, (dynamic)dto));
        }
コード例 #3
0
        public static String GetCacheKey <TResponse>(this PagedQuery <TResponse> query)
        {
            var properties = query.GetType()
                             .GetProperties(System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public)
                             .Select(x =>
            {
                var val = x.GetValue(query);
                if (val == null)
                {
                    return(x.Name + "/");
                }
                return(x.Name + "/" + val.ToString());
            });

            return("urn:{0}:{1}".Fmt(typeof(TResponse).FullName, properties.Join(":")));
        }