0

So far I was using something like this if I wanted to update table.

var myData = from t1 in db.Table1
where ...
select new { do some math here };

and then I would call

myData.Update( db.Table2, x => new Table2
{
    update columns here
}

That works great, but now I need to convert the myData query into List() so I can use that same data later in another update call. The problem with IQueryable is that when I call the Update for the second time later in code with this "myData", it includes data which were affected between the two updates, and I want the data as they were before the first update was called.

So I need this

var myData = (from t1 in db.Table1
where ...
select new { do some math here }).ToList();

to update table using the same call as before.

Mladen Macanović
  • 1,099
  • 7
  • 17

1 Answers1

1
var myData =
    from t1 in db.Table1
    where ...
    select new { do some math here };

var myDataList = myData.ToList();

myData.Update( db.Table2, x => new Table2
{
   update columns here
}

Is this what you are looking for?

IT.
  • 859
  • 4
  • 11
  • Not exactly. I need this myDataList.Update( db.Table2, x => new Table2 { update columns here } but it's not possible because myDataList is now object and not query – Mladen Macanović Sep 12 '11 at 14:23