示例#1
0
        public override Stream Process(Stream requestStream)
        {
            ServiceScopeWrapper serviceScope = this.RootContainer.CreateServiceScope();

            this.RequestContainer = serviceScope.ServiceProvider;

            try
            {
                RequestHandler handler = this.DispatchHandler();

                if (this.PreferenceContext.RespondAsync)
                {
                    return(handler.ProcessAsynchronously(requestStream));
                }
                return(handler.Process(requestStream));
            }
            catch (Exception e)
            {
                ErrorHandler handler = new ErrorHandler(this, e);
                return(handler.Process(null));
            }
            finally
            {
                serviceScope.Dispose();
            }
        }
示例#2
0
        protected bool TryDispatch(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)
        {
            RequestHandler handler = this.DispatchHandler();

            if (handler != null)
            {
                handler.Process(requestMessage, responseMessage);
                return(true);
            }

            return(false);
        }
示例#3
0
        public virtual Stream Process(Stream requestStream)
        {
            RequestHandler handler = this.DispatchHandler();

            if (handler != null)
            {
                return(handler.Process(requestStream));
            }

            StreamPipe pipe = new StreamPipe();

            this.Process(this.CreateRequestMessage(requestStream), this.CreateResponseMessage(pipe.WriteStream));

            return(pipe.ReadStream);
        }
示例#4
0
        public override Stream Process(Stream requestStream)
        {
            try
            {
                RequestHandler handler = this.DispatchHandler();

                if (this.PreferenceContext.RespondAsync)
                {
                    return(handler.ProcessAsynchronously(requestStream));
                }
                return(handler.Process(requestStream));
            }
            catch (Exception e)
            {
                ErrorHandler handler = new ErrorHandler(this, e);
                return(handler.Process(null));
            }
        }