Skip to content
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

Consider deprecating defining query #18903

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
Labels
area-query breaking-change closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

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
Member

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

AndriySvyryd added a commit that referenced this issue Jul 14, 2020
AndriySvyryd added a commit that referenced this issue Jul 15, 2020
@AndriySvyryd AndriySvyryd added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 15, 2020
@AndriySvyryd AndriySvyryd removed their assignment Jul 15, 2020
AndriySvyryd added a commit that referenced this issue Jul 17, 2020
AndriySvyryd added a commit that referenced this issue Jul 18, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0, 5.0.0-rc1 Aug 14, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0-rc1, 5.0.0 Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query breaking-change closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants