Globally Tag EF Core Queries with ".TagWithCallSite()"

Viewed 251

With the release of the .TagWithCallSite() method in EF Core 6.0 I was wondering if there is a way to apply this globally on every query run via a DbContext in some way?

It would be much better to apply this across the whole project without having to put it on each query individually.

2 Answers

No, you cant't do that.

When you explicitly define TagWithCallSite(), complier automatically fills default parameters filePath and lineNumber. It is not possible to define that for all queries because compiler do not store such information in Expression Tree.

Related