Is insert with EF faster and more efficient for hundreds of rows? RRS feed

  • Question

  • I am doing 700 rows inserted within 20secs with a for each using datatableadapter insert function. if I do that with EF savechanges, do I gain anything?

    is this faster? what is happening behind that savechanges? thanks for your help.

    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
    Friday, November 18, 2011 8:50 AM


  • Hi,

    EF isn't optimized for that kind of bulk operations, so I'll guess that it won't be significant quicker with SaveChanges. SaveChanges will call INSERT INTO ... for each of your rows, no bulk operations. However without knowing to much of how a Table adapter works internally I dont think that it is that much slower either...


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Friday, November 18, 2011 8:56 AM