tags:

views:

39

answers:

2

Generally for updating an item i am using

public static void UpdateCustomer<T>(T item) where T : class
    {
         var DB = GetNewDataContext();
         var table = DB.GetTable<T>();
         table.Attach(item);
         DB.Refresh(RefreshMode.KeepCurrentValues, item);
         DB.SubmitChanges();
   }

What is the way to update an array of item (List of items).

+1  A: 

With L2S, there is no Update() method. When you call SubmitChanges(), L2S will determine all entities (objects) that need to be updated, and update them automatically. So, if you want to update a batch of items, simply Attach all the items to be updated and call SubmitChanges().

Randy Minder
+1  A: 

Can't you use:

_table.AttachAll(items);
bobwah