What would be a performant approach for iterating a subset of records in a table with EF 6 in C#?
For .Take()
and .Skip()
I need to order the result first which I don't think is an option on large subsets.
Basically what I'm trying to do is iterate through every record from a .where
query with only loading each record one after another.
A fast way of:
using (Context context = new Context())
{
var parent = context.MetadataImportSets.Single(x => x.Id == 1);
var subset = context.Child.Where(x => x.Parent.Id == parent.Id);
foreach (var record in subset)
{
}
}