質問

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)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top