-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
good first issueThis issue should be relatively straightforward to fix.This issue should be relatively straightforward to fix.help wantedThis issue involves technologies where we are not experts. Expert help would be appreciated.This issue involves technologies where we are not experts. Expert help would be appreciated.
Milestone
Description
The idea is to support customizing the source query for a specific set at the model level, e.g.:
modelBuilder.Entity<Product>()
.FromSql("SELECT Id, UPPER(Name) AS Name FROM Products");Or using LINQ and some extra state such as the DbContext
modelBuilder.Entity<Product>()
.FromQuery<MyDbContext>((source, context) =>
source.Where(e => EF.Property(e, "TentantId") == context.TenantId);One possible advantage of having this in the model is that we would take it into account even if the entity type is included in the query as part of a navigation, e.g. it would make it possible to add additional filters on navigation properties even if they are populated using Include().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueThis issue should be relatively straightforward to fix.This issue should be relatively straightforward to fix.help wantedThis issue involves technologies where we are not experts. Expert help would be appreciated.This issue involves technologies where we are not experts. Expert help would be appreciated.