How to report DataContext.SubmitChanges() progress with LINQ2SQL

Posted by kzen on Stack Overflow See other posts from Stack Overflow or by kzen
Published on 2010-05-05T23:38:27Z Indexed on 2010/05/05 23:48 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

If there is a foreach loop that contains DataContext.Customer.InsertOnSubmit(cust) for example:

  foreach (Object obj in collection)
        {                    
            Customer cust = new Customer
            {
                Id = obj.Id,
                Name = obj.Name
                ...
            };
            DataContext.Customer.InsertOnSubmit(cust);
        }

And outside of the loop there is a call to:

DataContext.SubmittChanges();

Is there a way to obtain the SubmittChanges progress in order to report the progress back to the user (or a different approach without moving the SubmittChanges into the loop)?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#