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

Move defining query implementation to InMemory #21624

Open
AndriySvyryd opened this issue Jul 14, 2020 · 4 comments
Open

Move defining query implementation to InMemory #21624

AndriySvyryd opened this issue Jul 14, 2020 · 4 comments
Assignees
Labels
area-query consider-for-current-release punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-cleanup
Milestone

Comments

@AndriySvyryd
Copy link
Member

After the methods obsoleted in #18903 are removed the implementation and tests can be made in-memory-only.

@smitpatel
Copy link
Contributor

This cannot be done in 5.0

@smitpatel smitpatel removed their assignment Aug 27, 2020
@ajcvickers ajcvickers modified the milestones: Backlog, MQ Sep 11, 2020
@smitpatel
Copy link
Contributor

@dotnet/efteam - Defining queries are registered in model in OnModelCreating. Should it disallow usage of DbContext based members other than DbSet? Currently it may be working by accident in the way how they work. But we are functionally breaking it to make defining query work like a view for InMemory. Database views doesn't access DbContext members.

@AndriySvyryd
Copy link
Member Author

Yes, now would be a good moment to disallow it so we can get feedback from early adopters.

@smitpatel smitpatel self-assigned this Nov 5, 2021
@smitpatel smitpatel removed this from the Backlog milestone Nov 5, 2021
@ajcvickers ajcvickers added this to the 7.0.0 milestone Nov 9, 2021
@smitpatel
Copy link
Contributor

Few notes:

  • InMemory has TPH like mapping (so hierarchy must have discriminator property) but stored like TPC so each entity type has own InMemoryTable. Similar fashion, we will allow each entity type to have own defining query. For types which doesn't have it in hierarchy we will fall back to the table. We do union across all tables in InMemoryStore. So similar fashion union should be possible across mixed mapping.
  • Query pipeline needs to generate stream of ValueBuffer to be consumed just like table. We need to utilize query pipeline to do so. Note to ignore query filter when generating this so entity type level query filter should filter out results as needed in actual query. There could be dependency issues between which defining query needs to be processed first.
  • Above processing can go into model finalization step and store a delegate to generate stream in actual query.
  • Log a warning for any type in hierarchy not mapped to defining query if any of them is. (so mixed mapping is noticed by user).
  • Block invalid operations inside defining query like Include/IgnoreQueryFilter/AsTracking* methods.
  • The output of defining query can be a concrete type which is exactly same type as the entityType CLR type or an anonymous type which member names matching property names (anonymous type will allow providing values for shadow properties).

@ajcvickers ajcvickers added propose-punt punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Apr 22, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Apr 23, 2022
@smitpatel smitpatel removed their assignment Sep 14, 2022
@ajcvickers ajcvickers assigned AndriySvyryd and unassigned smitpatel Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query consider-for-current-release punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-cleanup
Projects
None yet
Development

No branches or pull requests

3 participants