Hello, I am using the latest runtime with self-servicing to process some large EDI files and am running into memory problems with entities while doing bulk inserts (5000+).......
i have several related entities with identity keys, and have to save them in order.
if (entity3.IsDirty)
{
entity1.save(false);
entity2.fk = entity1.pk;
entity2.save(false);
entity3.fk = entity2.pk;
entity3.save();
}
......... and so on........
after reading some forum threads, i decided to create only one instance of each entity and reuse it (earlier i was creating a new entity instance for every insert)
ClearFields (entity1);
entity1.IsNew = true;
ClearFields(entity2);
entity2.Isnew = true;
But even then, my memory profile has shown no improvement....... with 5000 inserts, the ram usage hits upto 1gb and windows starts paging like crazy.......
what is the right way to reuse entities and reduce my memory footprint...... i know bulk inserts/direct sql is better option for me, but because of lots of logic involved in parsing data, i have no choice but to do it through code.
Thanks
kiran