如题,EntityFramework 如何更新 detached 实体,如下代码不能更新:
Product p = null;
using (EFDbContext context = new EFDbContext()) {
p = context.Products.First();
}
using (EFDbContext context = new EFDbContext()) {
p.Remark = "aaa";
context.SaveChanges(); //不能更新
}
慕运维8079593