oData 8.0.3 with .NET5 reports an error when the query uses $select or $expand
@xuzhg is already working on this.
Since Nov 16, 2021.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
When we execute a query that uses $select or $expand, the request does not return data
Assemblies affected
Microsoft.NET.Sdk.Web
TargetFramework:net5.0
Microsoft.AspNetCore.Mvc.NewtonsoftJson: Version=5.0.12
Microsoft.AspNetCore.OData: Version=8.0.3
Microsoft.AspNetCore.SpaServices.Extensions: Version=5.0.12
Microsoft.OData.Core: Version=7.9.4
Microsoft.OData.Edm: Version=7.9.4
Microsoft.OData.ModelBuilder: Version=1.0.7
Reproduce steps
Create a WEB MVC project that targets Microsoft.NET.Sdk.Web, net5.0, create a query with a $select or $expand
Expected result
It should return data
Actual result
Failed to load response data: No data found for resource with given identifier
Additional detail
We recently migrated our project from net47 to net.5#.0. We upgraded oData to 8.3 and we have a serious problem
Queries that use $expand, $select do not work anymore, used to work
`
$expand=fillLevels,sensors&$filter=((deviceName/modelName%20eq%20'Rapidpoint%20500')%20and%20(deviceName/name%20eq%20'Rapidpoint%20500;10001'))%20and%20(IsActive%20eq%20true)&$top=10&$orderby=LocationSortOrder%20asc&$count=true
$select=errorId&$filter=(deviceIdent%20eq%20721)%20and%20((familyName%20eq%20'Bloodgas')%20and%20(deviceName/modelName%20eq%20'Rapidpoint%20500'))%20and%20(eventTime%20ge%202021-10-31T00:00:00.000Z%20and%20eventTime%20lt%202021-11-01T00:00:00.000Z)&$orderby=eventTime%20desc,errorId%20asc
`
Queries that use $filter, $orderby, $top, $apply are working perfect
`
$filter=measurementTime%20ge%202021-10-24T00:00:00.000Z%20and%20measurementTime%20lt%202021-11-01T00:00:00.000Z&$top=30&$orderby=measurementSortOrder%20asc,measurementTime%20desc&$count=true
$apply=filter(measurementTime%20ge%202021-10-24T00:00:00.000Z%20and%20measurementTime%20lt%202021-11-01T00:00:00.000Z)/groupby((lotNumber))
`
This is how we register oData
services.AddControllers().AddOData(option =>
{
option.Select();
option.Filter();
option.Count();
option.OrderBy();
option.Expand();
option.SetMaxTop(100);
option.TimeZone = TimeZoneInfo.Utc;
option.AddRouteComponents("odata", GetEdmModel());
option.AddRouteComponents("odata/{workspaceId}", GetEdmModel());
});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.