dotnet / dotnet/efcore

Provide extensibility to apply TagWith on internal EntityFinder queries (e.g., EntityEntry.GetDatabaseValues)

Open
#36,090 2 comments 1 reaction 1 assignee Claimed by @AndriySvyryd View on GitHub
area-change-tracking customer-reported needs-design
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

### What problem are you trying to solve?

We have a use-case where, by framework convention, every database query is required to include a TagWith() comment for traceability (e.g., debugging, profiling, audit trail).

This is easy for user-defined queries (dbContext.Set().TagWith(...)) but becomes a challenge for EF Core internal queries, like EntityEntry.GetDatabaseValues().

**Further technical details**
- EF Core version: 9.0.4
- Provider: SQL Server
- .NET 8.0

### Describe the solution you'd like

It would be helpful if EF Core provided an official extensibility point to influence system queries like these.

For example:

Make the creation of the _queryRoot query overridable or having protected instead of private _queryRoot, e.g., via a virtual method in EntityFinder.

Add a parameter to methods like GetDatabaseValues() to specify a tag string (similar to TagWith).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.