0
在某些情況下,我已經能夠將其誘騙檢測使用UpdateObject變化:的SaveChanges沒有做使用LINQ的實體,任何超過的OData
public UpdateOrderDescription(int userId)
{
var entities = new DatabaseEntities(new Uri("http://SomeServer/OrderService.svc")) { UsePostTunneling = true};
var order = (from o in entities.Orders where o.UserId == userId select o).Single();
order.Description = "Hello";
entities.UpdateObject(order);
entities.SaveChanges();
}
但是使用許多-TO-時不工作很多使用導航屬性的關係,因爲我無法在導航屬性上執行UpdateObject。
幫我搞定這個。你的意思是你的代碼片段有效,但還有另外一種情況是不行的? – 2012-03-07 20:18:47
是的,我希望它能夠自動檢測到這些變化(正如我在幾乎所有文檔和討論中所看到的)。 其次,我不知道如何告訴實體框架導航集合已經改變。 我想正確的答案,它根本無法這樣工作?您需要描述您對實體所做的所有更改。在實踐中,整個事物或多或少都是無用的。 – 2012-03-08 11:38:51