Skip to content

Consider deprecating defining query #18903

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 Nov 14, 2019 · 3 comments · Fixed by #21622
Closed

Consider deprecating defining query #18903

smitpatel opened this issue Nov 14, 2019 · 3 comments · Fixed by #21622

Comments

@smitpatel
Copy link
Contributor

In 3.0 we have limitations on how defining queries work. Main reason for that is to identify the user created custom projection as entity type. For keyless entity type it is circumvented due to it not using tracking. For keyed entity type it does not work (as mentioned as one of the problem in #17270).

If we look at #12668 then we decided that we don't treat entities created by user as an entity to be tracked. The main reason for this was incorrect assigned properties like key property missing. So what differs in defining query in that sense? If the custom projection in defining query used to create the object has incorrect formation then it would also fail (albeit differently). And even for keyless entity if the FK property is not computed properly then Includes wouldn't work correctly.

Another side of the coin in conjunction with #18457, defining query was invented in our pipeline as testing mechanism for keyless entity type in in-memory provider. If InMemory provider goes away then how much of value defining queries would provide to customer. For relational databases, likely they are mapped to database objects.

Lastly, defining query gives user a way to tell us that when a dbset is requested, replace it with this queryable. Removing this does not block that scenario fully. Instead of requesting dbset, user can define a property on DbContext which returns IQueryable and put the custom linq there. It just becomes user refactoring then first class concept in EF Core.

@ajcvickers
Copy link
Contributor

Triage: do this as part of #17270

@smitpatel
Copy link
Contributor Author

Defining query will be replaced by other methods
For relational provider - #17063
For inmemory provider - #20023
No support for defining query in cosmos provider.

@AndriySvyryd
Copy link
Member

Poaching

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

Successfully merging a pull request may close this issue.

5 participants