我想在我的asp.net MVC3 /代碼優先的實體框架應用程序中刪除一個對象,但我似乎沒有必要的選項,因爲它帶來了一個「不包含DeleteObject的定義」錯誤。任何人都知道我是否缺少裝配參考。這裏是我的倉庫代碼:無法在實體框架中調用DeleteObject - 缺少程序集引用?
private dbContext db = new dbContext();
public void DeleteAccessDetails(AccessDetails details)
{
db.DeleteObject(details); //error here as DeleteObject isn't recognised
}
這裏是我的引用:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySite.Models;
using System.Data;
using System.Data.Objects;
using System.Web.Mvc;
using System.Data.Entity;
我想有System.Data.Entity的就足夠了,彈出DeleteObject的,但智能感知很難造就任何選項 - 只處置,錄入,調用SaveChanges和設置
編輯:這也是我訪問的庫代碼:
Repository rep = new Repository();
AccessDetails paymentUpdate = rep.GetPaymentByID(item.AccessDetailsTableID);
rep.DeleteAccessDetails(paymentUpdate);
編輯2:這裏是我的引用文件夾的圖像:
感謝
正確的是,我的引用文件夾中沒有System.Data.Objects。當我查看添加引用部分(.NET選項卡)時,它不在那裏。 –