I am having trouble finding a good way to do fast bulk inserts in ServiceStacks Ormlite I will be performing the inserts against SQL Azure.
The only batch inserts that I could find would be to do as follows:
using (IDbTransaction dbTrans = Db.OpenTransaction())
{
foreach (var mfm in MFMs)
{
Db.Insert<Metrics>(mfm);
}
dbTrans.Commit();
}
But I am seeing no improvement in speed and I need to insert 20,000 records and it takes a tremendously long time.
Please advise if there is a good way to do this? Thanks
You may want to check SqlBulkCopy (follow the link for some numbers when using it in SQL Azure)