You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.
Filters don't work correctly if I repeat the same exactly query within an App Domain.
a) If I first load all entities (step 1) and then apply filters (step 2), I still get all entities in step 2. SQL Server profiler proves, that the same SQL query is sent as in step 1.
b) However, if I omit step 1 and start with step 2, filters are applied correctly. But then in step 3 filters are applied as well, although they should not be active in this context instance. SQL Server profiler proves, that the same SQL query is sent as in step 2.
I assume there is a bug with in your code, that Entity Framework query plan caching is not handled properly. Using DisableFilter() does not solve this problem. If I use slightly different queries in the different steps, the filters work fine.
var Ort = "abc";
// Step 1
using (var ctx1 = new FluggesellschaftContext())
{
var flugListe1 = ctx1.Fluege.Where(x => x.Abflugort.StartsWith(Ort)).ToList();
foreach (var f in flugListe1)
{
PrintFlug(f);
}
}
// Step 2
using (var ctx2 = new FluggesellschaftContext())
{
ctx2.EnableFilter("NichtRaucherFluege");
ctx2.EnableFilter("AuslastungHoch");
ctx2.EnableFilter("Mandant").SetParameter("fluggesellschaft", FlugGesellschaften.WorldWideWings);
var flugListe2 = ctx2.Fluege.Where(x => x.Abflugort.StartsWith(Ort)).ToList();
foreach (var f in flugListe2)
{
PrintFlug(f);
}
}
// Step 3
using (var ctx3 = new FluggesellschaftContext())
{
var flugListe3 = ctx3.Fluege.Where(x => x.Abflugort.StartsWith(Ort)).ToList();
foreach (var f in flugListe3)
{
PrintFlug(f);
}
}
The text was updated successfully, but these errors were encountered:
I am pretty sure that your problem is related to issue #8 There is an extensive discussion there. As you mentioned there is a query caching mechanism inside entity framework which is the cause of the problem you face. In issue #8 there is an approach on how to solve it.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Filters don't work correctly if I repeat the same exactly query within an App Domain.
a) If I first load all entities (step 1) and then apply filters (step 2), I still get all entities in step 2. SQL Server profiler proves, that the same SQL query is sent as in step 1.
b) However, if I omit step 1 and start with step 2, filters are applied correctly. But then in step 3 filters are applied as well, although they should not be active in this context instance. SQL Server profiler proves, that the same SQL query is sent as in step 2.
I assume there is a bug with in your code, that Entity Framework query plan caching is not handled properly. Using DisableFilter() does not solve this problem. If I use slightly different queries in the different steps, the filters work fine.
The text was updated successfully, but these errors were encountered: