Exemplo n.º 1
0
        /// <inheritdoc />
        protected override async Task WriteOperationCustomResultAsync(HttpContext httpContext, ODataRequest odataRequest, object result, int?allCount)
        {
            if (result is IEnumerable <ODataEntity> dictionaryList)
            {
                await WriteAsync(ODataMultipleContent.Create(dictionaryList, allCount ?? dictionaryList.Count()), httpContext, odataRequest)
                .ConfigureAwait(false);

                return;
            }
            if (result is IEnumerable <ODataObject> customContentList)
            {
                await WriteAsync(ODataMultipleContent.Create(customContentList, allCount ?? 0), httpContext, odataRequest)
                .ConfigureAwait(false);

                return;
            }

            await WriteAsync(result, httpContext, odataRequest)
            .ConfigureAwait(false);
        }
Exemplo n.º 2
0
 /// <inheritdoc />
 protected override async Task WriteMultipleContentAsync(HttpContext httpContext, ODataRequest odataRequest, IEnumerable <ODataEntity> contents, int count)
 {
     await WriteAsync(ODataMultipleContent.Create(contents, count), httpContext, odataRequest).ConfigureAwait(false);
 }