Very Slow Update

Oct 24, 2012 at 5:01 PM
Edited Oct 24, 2012 at 5:01 PM

Hello.

I've been using the FluentData API for a few days now and I'm very happy with it.  However, I've run into one problem.  My updates are very very slow.

I'm using the same construct I do for inserts.  But, this contstruct is too slow for the updates.  Simply put I have a list of objects and I want to use that list to update a table in the data base.

Here is what I'm doing.

using (var command = Context()) 

{

 foreach (var employee in employees) 

 {           

 int rowsAffected =

        Context().Update<Some.Table>("Some.Tabe", employee)  .Column(x => x.FirstName)  .Where(x => x.EmployeeNumber)

.Execute();

}
}

 

35k records are taking about 20mins to update.

Thank you so much for any input.

 

M.

Coordinator
Oct 25, 2012 at 8:41 AM

Can you try to change:
using (var command = Context()) 

 into:
using (var command = Context().UseSharedConnection(true))  

since you do many updates then this will tell fluentdata to use the same connection for all of them.

 

Regards,

Lars-Erik Kindblad