Getting SQL queries generated with Entity Framework Plus?

entity-framework-6 entity-framework-plus

Question

I am enjoying the features of Entity Framework Plus over Entity Framework 6 since a few hours, and especially its IncludeFilter.

With regular Entity Framework 6, I was able to simply call ToString() on an IQueryable to easily get the SELECT query that will be actually processed on DB Server.

But with EF+, when I apply an IncludeFilter, I only get :

 Z.EntityFramework.Plus.QueryIncludeFilterParentQueryable`1[MyRecord]

Because ToString() seems to not be overloaded the same way in EF+.

Is there a way to get SQL generated for "IncludeFilter" queries as well as for classical queries ?

I know I could get it on SQL server itself with the adequate profiling tools, but I would like to be able to do it on code side in EF.

1
1
5/10/2019 1:58:42 PM

Expert Answer

Is there a way to get SQL generated for "IncludeFilter" queries as well as for classical queries ?

No, there is currently no way.

It might come later but at this moment, the library doesn't offer this feature.

(I'm the owner)

EDIT: Answer comment

My main worry was to know if the generated queries are optimized

I would not call them optimized. They are generated by Entity Framework and nothing is really modified on our side.

  • IncludeFilter: Create one VERY big query like Include does in EF6
  • IncludeOptimized: Create multiple small queries like Include does in EF Core
2
5/13/2019 1:44:51 PM

Popular Answer

You can use the current context's log to track all requests performed under this instance

        context.Database.Log = s => Console.WriteLine(s);


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow