DefaultSkipTokenHandler can't find a property in nested object when the same property name exists in the main object
@Sreejithpin is already working on this.
Since Feb 8, 2022.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I wasn't able to retrieve a nextlink with a $skiptoken value set to Category/Id, using below classes and configurations.
using nuget Odata/AspNetCoreOData 8.0.5
// odata query: /products?$orderby=Category/Id
public class Product {
public Guid Id { get; set; }
public Category Category { get; set; }
}
public class Category {
public Guid Id { get; set; }
public string Code { get; set; }
}
// startup.cs
builder.EntitySet<Product>("products");
Did I forgot something such as an attribute on the Category/Id field, or a configuration on the edm ?
(I can't use the NotMapped attribute because I need to be able to order or filter on Product.Id)
If I didn't miss an attribute or a configuration, then here is what prevents me from getting the right skiptoken:
Category has a property 'Id' which share the same name as the property 'Id' from Product.
In the DefaultSkipTokenHandler.GenerateSkipTokenValue() line 139 or 143, implementation get the property name from the model (Product) and doesn't take into account the edmProperty Type (in my case, Category), when it resolves its value.
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.