摘要: 为什么有时候在EF 中删除不了表呢?先上代码:var deleteObj = adminDpProEntity.ToTAdminDpPro();_db.t_sys_admin_dp_product.DeleteObject(deleteObj);报错:The object cannot be deleted because it was not found in the ObjectStateManager。一搜索:原来是因为DeleteObject方法必须是先关联实体,或者实体来自查询。代码改为_db.t_sys_admin_dp_product.Attach(deleteObj); ... 阅读全文
posted @ 2012-10-24 19:12 瓜王 阅读(1361) 评论(0) 推荐(1) 编辑