-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature/netcore] Nested $expand
not working
#1205
Comments
@techniq - Can you provide the code that builds the model? |
@techniq - Can you provide the code that builds the model? |
@robward-ms Actually, I think I have more details that can help (after some more testing). Currently, this still returns the [EnableQuery()]
public IQueryable<Employee> Get()
{
return DbContext.Employees;
} but using the following fixes this problem [HttpGet]
public IActionResult Get(ODataQueryOptions<Employee> queryOptions)
{
var querySettings = new ODataQuerySettings()
{
// Workaround for: https://github.com/aspnet/EntityFrameworkCore/issues/10721
HandleNullPropagation = HandleNullPropagationOption.False
};
var query = queryOptions.ApplyTo(DbContext.Set<Employee>(), querySettings);
return Ok(query);
} Removing |
@techniq - On EFCore? There is some code missing to set NullPropgation for EFCore, I have it in the EFCore investigation branch: https://github.com/robward-ms/WebApi/blob/0ba1ddca056555a1aef556e6493c57b29dcef2ed/src/Microsoft.AspNet.OData.Shared/Query/HandleNullPropagationOptionHelper.cs |
@robward-ms yes, |
Resolved, thanks @robward-ms |
When attempting to expand more than 1 level deep the property is added to the model but set to null. I also do not see any mention of it in the EFCore sql query. Other operators seem to work (at least
$select
)Assemblies affected
Reproduce steps
Attempt to expand more than 1 level deep. For example:
http://localhost:5000/odata/Employees?$expand=Supervisor($expand=Position)
Expected result
Actual result
Additional detail
I've attempted to set
[EnableQuery(MaxExpansionDepth = 3)]
on the endpoint but resulted in no change.The text was updated successfully, but these errors were encountered: