I need to add some data into my postgres DB, about 600,000 rows in different tables, which can grow to much more. I am using Entity frame work to fill the DB. Unfortunately, for large data my code does not work, first it show me this error "Connection must be open" and in the next try it says "Exception of type 'System.OutOfMemoryException' was thrown". It's fair to say the problem is memory consumption of entity framework, as this code works for small data beautifully. I tried to release the memory by calling GC.Collection but it hasn't worked.
public void saveChanges()
{
dbef.SaveChanges();
GC.Collect();
GC.Collect();
dbef = new CIFImporterEF();
}
Any idea about fixing this problem. Thanks