BLToolkit 更新为非 IQueryable
到目前为止,如果我想更新表,我正在使用类似的东西。
var myData = from t1 in db.Table1
where ...
select new { do some math here };
然后我会调用
myData.Update( db.Table2, x => new Table2
{
update columns here
}
这效果很好,但现在我需要将 myData 查询转换为 List() ,以便稍后我可以在另一个更新调用中使用相同的数据。 IQueryable 的问题是,当我稍后在代码中使用此“myData”第二次调用更新时,它包含两次更新之间受影响的数据,并且我希望数据与调用第一次更新之前的数据相同。
所以我需要
var myData = (from t1 in db.Table1
where ...
select new { do some math here }).ToList();
使用与之前相同的调用来更新表。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您要找的吗?
Is this what you are looking for?