我有這個事情:爲什麼dataContext.GetChangeSet()。Deletes.Count()總是返回0?
var customerIdsToDelete = new {1, 2, 3};
var dataContext = new DataContext();
var customersToDelete = (from c in data.Customers
where customerIdsToDelete.Contains(c.CustomerID)
select c);
data.Customers.DeleteAllOnSubmit(customersToDelete);
data.SubmitChanges();
var deletedCount = data.GetChangeSet().Deletes.Count();
即使當客戶成功刪除deletedCount
將爲0
爲什麼?那麼刪除customers
的次數的「正確」方法是什麼?
人力資源管理,如果由於某種原因在變更集中的客戶不會被刪除(也許有一些數據庫約束阻止了這一點)有無論如何來確定? – 2011-02-16 00:36:59