Calling the following code:
```
// aValue and aNumber are guaranteed valid integers for this scenario.
// myPK is the primary key and is of type int.
var cdrs = entities.MyTable.AsNoTracking().Where(x => x.myPK > aValue).Take(aNumber);
int numberOfResults = cdrs.Count();
int numberOfResultsFromList = cdrs.ToList().Count();
int index = 0;
foreach(var cdr in cdrs)
{
index++;
//More processing.
}
```
Results in:
numberOfResults == aNumber
numberOfResultsFromList == index > numberOfResults
The results are always inconsistent. For example, running the above query with exactly the same values for aValue and aNumber, repeatesly results in varying numberOfResultsFromList, always greater than aNumber by a factor of approximately 15-30%.
Additionally I have noticed that Take() in the above scenario frequently (but not always) skips some results and does not take the first X from the set, although the results are definitely consecutive. Looping the above returns blocks of consecutinve results, but the blocks are randomly positioned in the db. Of course all use of the context is wrapped within a using statement.
I am sorry but I am not in the liberty to share more of the code (although there is very little more).
The entities is a db-first DbContext with only one table, dropped in the designer with absolutely no changes made, using Entity framework 6.0.0-alpha3. Immediatelly after creating the context I run this query and the results are the above mentioned.
Comments: Closing this as no-repro since we haven't heard back on a reliable repro. Will re-open if a repro comes in.
```
// aValue and aNumber are guaranteed valid integers for this scenario.
// myPK is the primary key and is of type int.
var cdrs = entities.MyTable.AsNoTracking().Where(x => x.myPK > aValue).Take(aNumber);
int numberOfResults = cdrs.Count();
int numberOfResultsFromList = cdrs.ToList().Count();
int index = 0;
foreach(var cdr in cdrs)
{
index++;
//More processing.
}
```
Results in:
numberOfResults == aNumber
numberOfResultsFromList == index > numberOfResults
The results are always inconsistent. For example, running the above query with exactly the same values for aValue and aNumber, repeatesly results in varying numberOfResultsFromList, always greater than aNumber by a factor of approximately 15-30%.
Additionally I have noticed that Take() in the above scenario frequently (but not always) skips some results and does not take the first X from the set, although the results are definitely consecutive. Looping the above returns blocks of consecutinve results, but the blocks are randomly positioned in the db. Of course all use of the context is wrapped within a using statement.
I am sorry but I am not in the liberty to share more of the code (although there is very little more).
The entities is a db-first DbContext with only one table, dropped in the designer with absolutely no changes made, using Entity framework 6.0.0-alpha3. Immediatelly after creating the context I run this query and the results are the above mentioned.
Comments: Closing this as no-repro since we haven't heard back on a reliable repro. Will re-open if a repro comes in.