How many InsertOnSubmit
should I call before calling SubmitChanges
? I'm adding data from a web service that can return tens of thousands of records one record at a time. The wrapper class around the web service exposes the records a an IEnumberable
collection to hide an elaborate chunking mechanism.
Are there guidelines on how many inserts I should accumulate before submitting them?
It also depends on the kind of data you need to insert. Sometimes I need to insert a lot of records, where I also need the ID of, to insert more records in another table.
Because the ID gets assigned when you submit changes to the database, I need to call SubmitChanges on specific times.
When this is not needed, I just submit them with a 1000 at once or so (depending on the total number of records I need to insert).
Maybe you could do some speed tests, which are best for you. Depending on the hardware, expectations of amount of records, etc.