Page 1 of 1

performance

Posted: Thu 02 Apr 2009 15:36
by dynapro
Hi @all

The following method needs about five minutes for 200 000 objects. If if just create an add the object and do not update the entities into the Oracle DB (entities.SaveChanges) it takes 4sec.

The Class Entities is created by the wizzard and contains the class PERSON.

public void TestEntities(string connectionString)
{
var entities = new Entities(connectionString);

long nextID = (from it in Loaded_entities.PERSON select it.ID).Max();

for (int j = 0; j <= 100000; j++, ++nextID)
{
var p = new PERSON
{
ID = (nextID),
NAME = "The Name"
};
entities.AddObject(typeof(PERSON).Name, p);
}
entities.SaveChanges(); //this needs soooooo long ;-((
}


What can i do to get a better performance?

thx and best wishes
martin

Posted: Fri 03 Apr 2009 07:01
by AndreyR
The problem is associated with the peculiarities of the Entity Framework architecture.
You can find some information concerning the performance improvement here:
http://msdn.microsoft.com/en-us/library/cc853327.aspx