我有這樣的錯誤在C#程序BMS_DAL.BMSDataContext類型必須是隱式轉換爲「System.IDisposable的
public bool Delete(ref ENTValidationErrors validationErrors, int userAccountId)
{
if (DBAction == DBActionEnum.Delete)
{
// Begin database transaction
using (TransactionScope ts = new TransactionScope())
{
// Create data context
using (BMSDataContext db = new BMSDataContext())
{
this.Delete(db, ref validationErrors, userAccountId);
if (validationErrors.Count == 0)
{
//Commit transaction since the delete was successful
ts.Complete();
return true;
}
else
{
return false;
}
}
}
}
else
{
throw new Exception("DBAction not delete.");
}
}
第二齣現的錯誤‘使用說明’,上面寫着「BMS_DAL在using語句中使用.BMSDataContext類型必須是隱式轉換爲「System.IDisposable的」」。
什麼一定是錯在這裏?