Ejemplo n.º 1
0
        /// <inheritdoc/>
        public virtual async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            IHttpActionResult result = GetInnerActionResult();
            var response             = await result.ExecuteAsync(cancellationToken);

            ResultHelpers.AddServiceVersion(response, () => ODataUtils.ODataVersionToString(ResultHelpers.GetODataResponseVersion(Request)));
            return(response);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public async virtual Task ExecuteResultAsync(ActionContext context)
        {
            HttpResponse  response = context.HttpContext.Response;
            HttpRequest   request  = context.HttpContext.Request;
            IActionResult result   = GetInnerActionResult(request);
            await result.ExecuteResultAsync(context);

            ResultHelpers.AddServiceVersion(response, () => ODataUtils.ODataVersionToString(ResultHelpers.GetODataResponseVersion(request)));
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public virtual async Task <HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
        {
            IHttpActionResult   result   = GetInnerActionResult(Request);
            HttpResponseMessage response = await result.ExecuteAsync(cancellationToken);

            response.Headers.Location = LocationHeader;
            ResultHelpers.AddEntityId(response, () => GenerateEntityId(Request));

            return(response);
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public async virtual Task ExecuteResultAsync(ActionContext context)
        {
            HttpRequest   request  = context.HttpContext.Request;
            HttpResponse  response = context.HttpContext.Response;
            IActionResult result   = GetInnerActionResult(request);

            response.Headers["Location"] = GenerateLocationHeader(request).ToString();

            // Since AddEntityId relies on the response, make sure to execute the result
            // before calling AddEntityId() to ensure the response code is set correctly.
            await result.ExecuteResultAsync(context);

            ResultHelpers.AddEntityId(response, () => GenerateEntityId(request));
        }
Ejemplo n.º 5
0
        /// <inheritdoc/>
        public async virtual Task ExecuteResultAsync(ActionContext context)
        {
            HttpRequest   request  = context.HttpContext.Request;
            HttpResponse  response = context.HttpContext.Response;
            IActionResult result   = GetInnerActionResult(request);
            Uri           location = GenerateLocationHeader(request);

            response.Headers["Location"] = location.AbsoluteUri;
            // Since AddEntityId relies on the response, make sure to execute the result
            // before calling AddEntityId() to ensure the response code is set correctly.
            await result.ExecuteResultAsync(context);

            ResultHelpers.AddEntityId(response, () => GenerateEntityId(request));
            ResultHelpers.AddServiceVersion(response, () => ODataUtils.ODataVersionToString(ResultHelpers.GetODataResponseVersion(request)));
        }
Ejemplo n.º 6
0
 internal Uri GenerateLocationHeader(HttpRequestMessage request)
 {
     return(ResultHelpers.GenerateODataLink(request, Entity, isEntityId: false));
 }
Ejemplo n.º 7
0
 internal Uri GenerateEntityId(HttpRequestMessage request)
 {
     return(ResultHelpers.GenerateODataLink(request, Entity, isEntityId: true));
 }
Ejemplo n.º 8
0
 // internal just for unit test.
 internal Uri GenerateEntityId(HttpRequest request)
 {
     return(ResultHelpers.GenerateODataLink(request, _innerResult, isEntityId: true));
 }