Example #1
0
        public Task <object> Execute(HttpListenerHost appHost, object requestDto, IRequest req)
        {
            req.Dto = requestDto;
            var requestType = requestDto.GetType();

            req.OperationName = requestType.Name;

            var serviceType = appHost.GetServiceTypeByRequest(requestType);

            var service = appHost.CreateInstance(serviceType);

            //var service = typeFactory.CreateInstance(serviceType);

            var serviceRequiresContext = service as IRequiresRequest;

            if (serviceRequiresContext != null)
            {
                serviceRequiresContext.Request = req;
            }

            if (req.Dto == null) // Don't override existing batched DTO[]
            {
                req.Dto = requestDto;
            }

            //Executes the service and returns the result
            return(ServiceExecGeneral.Execute(serviceType, req, service, requestDto, requestType.GetMethodName()));
        }
Example #2
0
        public Task <object> Execute(HttpListenerHost httpHost, object requestDto, IRequest req)
        {
            var requestType = requestDto.GetType();

            req.OperationName = requestType.Name;

            var serviceType = httpHost.GetServiceTypeByRequest(requestType);

            var service = httpHost.CreateInstance(serviceType);

            if (service is IRequiresRequest serviceRequiresContext)
            {
                serviceRequiresContext.Request = req;
            }

            // Executes the service and returns the result
            return(ServiceExecGeneral.Execute(serviceType, req, service, requestDto, requestType.GetMethodName()));
        }