Provide extensibility to apply TagWith on internal EntityFinder queries (e.g., EntityEntry.GetDatabaseValues)
- 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
Assessment
This issue has not been assessed yet.