我正在使用 EF 4.5 并且必须获取一些记录并更新已获取记录的标志。我可以在相同的情况下这样做吗?
using (var context = new MyDBEntities())
{
var qry = from a in context.Table1
select a;
foreach(var item in qry)
{
// Logic to fill custom entity (DTO) from qry
item.Fetched = 2; // Changing the status of fetched records in DB
context.Table1.Add(item);
}
context.SaveChanges();
}