LINQKit icon indicating copy to clipboard operation
LINQKit copied to clipboard

Support EF Core 2.2 query tagging from inside expressions

Open KLuuKer opened this issue 7 years ago • 6 comments

I have a couple of (complicated) expressions that get reused allot so I would like to have the tagging support from inside the expression so I don't have to specify it everywhere manually

https://docs.microsoft.com/en-us/ef/core/querying/tags/

KLuuKer avatar Nov 27 '18 05:11 KLuuKer

Do you just want to use the

.TagWith("...")

functionality?

And why is this not supported now ?

StefH avatar Nov 27 '18 07:11 StefH

yes, because that method is only available on iquerable's

and my expressions always start from some class like

Expression<Func<Product, decimal>> HowMuchStockDoesThisProductHave()

KLuuKer avatar Nov 27 '18 09:11 KLuuKer

If it's defined on IQueryable, you can just use it ? So why this issue ?

StefH avatar Nov 27 '18 12:11 StefH

I use a bunch of expressions like the one above all over the place and would like to not have to both specify the expression and adding the tag to the query

only add the tag from inside the expression once

KLuuKer avatar Nov 27 '18 17:11 KLuuKer

But the question remains : is this functionality which belongs in LinqKit?

StefH avatar Nov 28 '18 07:11 StefH

it would make tracking expression usage allot more easier

we use the querystore to diagnose sql query perf issues and the like https://docs.microsoft.com/en-us/sql/relational-databases/performance/query-store-usage-scenarios?view=sql-server-2017

and you can also see the actual sql query being executed so it would be nice if we can easily add the tags from inside the expressions

KLuuKer avatar Nov 28 '18 08:11 KLuuKer