Skip to content

Query: OrderBy(entity) mean different things across relational/non-relational providers #10116

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
smitpatel opened this issue Oct 18, 2017 · 2 comments

Comments

@smitpatel
Copy link
Contributor

var query = db.Posts.OrderBy(p => p.Blog).ToList();

At present when there is query which is ordering by an entity type, when evaluated on server converts orderby clause to ordering on PK properties. Since this happens during SqlTranslation, InMemory does not do this. Because of this, if entityType does not implement IComparer then InMemory throws exception whereas relational provider would just work fine. On the other hand, if there IComparer implemented and has different comparison order than keys then relational results would be incorrect.

We should decide on one behavior and make it consistent across relational/non-relational providers.

@ajcvickers ajcvickers added this to the Backlog milestone Oct 20, 2017
@smitpatel smitpatel removed this from the Backlog milestone Mar 15, 2020
@smitpatel smitpatel self-assigned this Mar 15, 2020
@ajcvickers ajcvickers added this to the 5.0.0 milestone Mar 16, 2020
@ajcvickers
Copy link
Contributor

Remember to document this.

@smitpatel
Copy link
Contributor Author

Fixed in #20447
Now OrderBy entity to OrderBy entity.PK transformation happens in Nav expansion hence it is consistent across all providers.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants