Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8737317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:29:34+00:00 2026-06-13T10:29:34+00:00

I have a WebApi controleller, and added the filters from BreezeJs to support queryable

  • 0

I have a WebApi controleller, and added the filters from BreezeJs to support queryable requests like $orderby=DateAdded&$top=8.

  GlobalConfiguration.Configuration.Filters.Add(
      new Breeze.WebApi.ODataActionFilter());

everything works fine. This only give 8 results. What do i need to do to add such the total count is also returned with the result?

UPDATE

 public class ODataHandler : DelegatingHandler
  {
      protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
      {
          return base.SendAsync(request, cancellationToken).ContinueWith(
            task =>
            {
                var response = task.Result;

                if (ResponseIsValid(response) && ShouldInlineCount(request))
                {
                    object responseObject;
                    response.TryGetContentValue(out responseObject);

                    if (responseObject is IQueryable)
                    {
                        var renum = responseObject as IEnumerable<object>;

                        if (renum != null)
                        {
                            response = request.CreateResponse(HttpStatusCode.OK, new ODataMetadata<object>(renum, renum.Count()));
                        }
                    }
                }

                return response;
            });
      }
      private bool ShouldInlineCount(HttpRequestMessage request)
      {

        var queryParams = request.RequestUri.ParseQueryString();

        var inlinecount = queryParams["$inlinecount"];

        return string.Compare(inlinecount, "allpages", true) == 0;

       }

      private bool ResponseIsValid(HttpResponseMessage response)
      {
          if (response == null || response.StatusCode != HttpStatusCode.OK || !(response.Content is ObjectContent)) return false;
          return true;
      }
  }

This is what i came up with so far. But problem is that the filter have already added teh TOP 8 to the request before the handler kicks in. So count will be 8 and not total.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:29:35+00:00Added an answer on June 13, 2026 at 10:29 am

    Excellent question. The OData support in the current version of Breeze does not understand the $inlinecount parameter for OData 2.0 which, I think, is what you are looking for. It is on the backlog. Please vote up that idea on the Breeze user voice.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a MVC application and added new WebApi controller in it called
I have webapi controller with 2 action methods like so: public List<AlertModel> Get() {
I am using webapi controller.I have to pass an JSON object from Java applet
I have MVC webApi application which works with Unity . I have to resolve
I have a desktop webapi server that I want to expose to clients through
I have a Asp.net WebAPI service that is hosted on AppHarbor which throws 404
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
I've created a method using the new WebAPI features in MVC4 and have it
I have a WebApi project and I am trying to add an area to
I have an ASP.NET WebApi project that utilizes Entity Framework 4.1. I am attempting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.