我在 C# 程序中有这个错误
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.BMSDataContext type used in using statement must be implicitly convertible to "System.IDisposable"'。
这里一定有什么问题?