Ejemplo n.º 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();
            }
        }
Ejemplo n.º 2
0
        protected bool TryDispatch(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)
        {
            RequestHandler handler = this.DispatchHandler();

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

            return(false);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
            }
        }