Como evitar o estouro de memória ao usar um IEnumerable <T> e Linq-To-Sql?
Esta questão está relacionada comuma pergunta anterior minha
Esse é o meu código atual
IEnumerable<Shape> Get()
{
while(//get implementation
yield return new Shape(//...
}
void Insert()
{
var actual = Get();
using (var db = new DataClassesDataContext())
{
db.Shapes.InsertAllOnSubmit(actual);
db.SubmitChanges();
}
}
Estou recebendo um estouro de memória, já que o IEnumerable é muito grande. Como evito isso?