Пример #1
0
        public async Task <object> Send(QueryRequest query)
        {
            var typeInformation = new QueryRequestTypeInformation(query);

            var queryObject = JsonConvert.DeserializeObject(query.QueryData, typeInformation.QueryType);

            var handlerType = typeof(IQueryHandler <,>).MakeGenericType(typeInformation.QueryType, typeInformation.ResultType);

            var handler = serviceLocator.Resolve(handlerType);

            var sendMethodInfo = handlerType.GetMethod("Send");

            return(await(dynamic) sendMethodInfo.Invoke(handler, new[] { queryObject }));
        }
Пример #2
0
        public async Task<object> Send(QueryRequest query)
        {
            var typeInformation = new QueryRequestTypeInformation(query);

            var queryObject = JsonConvert.DeserializeObject(query.QueryData, typeInformation.QueryType);

            var handlerType = typeof(IQueryHandler<,>).MakeGenericType(typeInformation.QueryType, typeInformation.ResultType);

            var handler = serviceLocator.Resolve(handlerType);

            var sendMethodInfo = handlerType.GetMethod("Send");

            return await (dynamic)sendMethodInfo.Invoke(handler, new[] { queryObject });
        }