Batch Updates EF Code First
Posted: Mon 26 Dec 2011 10:46
Hi,
We are using EF 4.1 and dotConnect for Oracle 6.5.
In out project, we need to execute large number of insert operations(about 30.000) and it takes about 30min to execute.
We've already enabled BatchUpdates, disabled AutoDetectChangesEnabled but nothing changed.
Our model is like that:
and the usage is:
Is BatchUpdates not compatible with inner collections?
What I mean is, in our case batchorder has about 30.000 orders and when we add batchorder to repository, 30.000 prepare&execute commands are executed on the db. What I expected is that, there would be a single prepare&execute statement for 30.000 order.
Any help will be appreciated.
We are using EF 4.1 and dotConnect for Oracle 6.5.
In out project, we need to execute large number of insert operations(about 30.000) and it takes about 30min to execute.
We've already enabled BatchUpdates, disabled AutoDetectChangesEnabled but nothing changed.
Our model is like that:
Code: Select all
public abstract class BatchOrder
{
//..
public virtual ICollection Orders { get; set; }
//..
}
Code: Select all
Repository.Add(batchOrder);
var sw = Stopwatch.StartNew();
UnitOfWork.Commit();
What I mean is, in our case batchorder has about 30.000 orders and when we add batchorder to repository, 30.000 prepare&execute commands are executed on the db. What I expected is that, there would be a single prepare&execute statement for 30.000 order.
Any help will be appreciated.