Fastest Way of Inserting in Entity Framework

前端 未结 30 2118
鱼传尺愫
鱼传尺愫 2020-11-21 05:23

I\'m looking for the fastest way of inserting into Entity Framework.

I\'m asking this because of the scenario where you have an active TransactionScope a

30条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-21 05:59

    The fastest way would be using bulk insert extension, which I developed

    note: this is a commercial product, not free of charge

    It uses SqlBulkCopy and custom datareader to get max performance. As a result it is over 20 times faster than using regular insert or AddRange EntityFramework.BulkInsert vs EF AddRange

    usage is extremely simple

    context.BulkInsert(hugeAmountOfEntities);
    

提交回复
热议问题