You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I make a request to the specified url, it gives the following error, other requests work fine. The version I use is the latest version.
Microsoft.OData.ODataException: The value of type 'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[[WebUI.DataTransferObject.Server.PhotoDto, WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be converted to a raw string.
The text was updated successfully, but these errors were encountered:
Digging through the sources I found that GetQuery() / GetQueryAsync() sets the OData feature "TotalCount" if you request $count. So this is my solution/workaround I came up with to get $count working:
public IActionResult Get([FromServices]ODataQueryOptions<Entity>options){IQueryable<Entity>query= dbContext.Entities.GetQuery(mapper, options);return options.Count?.Value ==true? Ok(options.Request.ODataFeature().TotalCount): Ok(query);}
url: https://localhost:5001/api/Photos/$count
When I make a request to the specified url, it gives the following error, other requests work fine. The version I use is the latest version.
Microsoft.OData.ODataException: The value of type 'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[[WebUI.DataTransferObject.Server.PhotoDto, WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' could not be converted to a raw string.
The text was updated successfully, but these errors were encountered: