简体   繁体   中英

asp.net boilerplate odata count

I'm developing asp.net core boilerplate application with odata support. I'm trying to enable $count parametr:

app.UseOData(builder =>
            {
                builder.EntitySet<Message>("Messages").EntityType.Count().Filter().OrderBy().Expand().Select().Page().Count();//.Expand().Filter().OrderBy().Page();
            });

and request is:

/odata/Messages?%24count=true&%24filter=indexof(tolower(Guid)%2C+%27a3eee6ec-d232-42f7-93cc-fd6062fb39b6%27)+gt+-1

but response has no count:

{
"result": [
{
"guid": "a3eee6ec-d232-42f7-93cc-fd6062fb39b6",
"id": 140
}
],
"targetUrl": null,
"success": true,
"error": null,
"unAuthorizedRequest": false,
"__abp": true
}

How to add count to response with boilerblate odata?

ps

<ItemGroup>

    <PackageReference Include="Abp.AspNetCore.OData" Version="3.8.2" /> 
    <PackageReference Include="Abp.AspNetCore.SignalR" Version="3.7.2" />
    <PackageReference Include="Abp.AspNetCore" Version="3.8.2" />
    <PackageReference Include="Microsoft.AspNetCore.OData" Version="7.0.1" />    

    ... 

  </ItemGroup>

要在结果中计数,网址应为:

/odata/message?$count=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM