scottksmith95 / LINQKit

LINQKit is a free set of extensions for LINQ to SQL and Entity Framework power users.
MIT License
1.64k stars 163 forks source link

Support EF Core 2.2 query tagging from inside expressions #85

Open KLuuKer opened 5 years ago

KLuuKer commented 5 years ago

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/

StefH commented 5 years ago

Do you just want to use the

.TagWith("...")

functionality?

And why is this not supported now ?

KLuuKer commented 5 years ago

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

and my expressions always start from some class like

Expression<Func<Product, decimal>> HowMuchStockDoesThisProductHave()
StefH commented 5 years ago

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

KLuuKer commented 5 years ago

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

StefH commented 5 years ago

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

KLuuKer commented 5 years ago

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