LINQ to SQL SubmitChangess() progress

Posted by Emir on Stack Overflow See other posts from Stack Overflow or by Emir
Published on 2010-12-30T15:27:38Z Indexed on 2010/12/30 15:54 UTC
Read the original article Hit count: 362

Filed under:
|
|
|

I'm using LINQ to SQLto import old DBF files into MSSQL. I'm reading all rows and adding them to database using ctx.MyTable.InsertOnSubmit(row)

After reading phase is completed I have around 100 000 pending inserts. ctx.SubmitChanges() naturally is taking a long time.

Is there any way to track progress of the ctx.submitchanges()? Can ctx.Log somehow be used for this purpose?

Update: Is it possible to use ctx.GetChangeSet().Inserts.Count and track insert statements using the Log?

Dividing ctx.SubmitChanges() into smaller chunks is not working for me, because I need transaction, all or nothing.

Update 2: I've found nice class ActionTextWriter using which I will try to count inserts.

http://damieng.com/blog/2008/07/30/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers

© Stack Overflow or respective owner

Related posts about c#

Related posts about linq-to-sql