【发布时间】:2012-08-30 19:27:17
【问题描述】:
我在 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.");
}
}
错误发生在第二个“using 语句”上。它说 '在 using 语句中使用的 BMS_DAL.BMSDataContext 类型必须隐式转换为“System.IDisposable”'。
这里一定有什么问题?
【问题讨论】:
标签: c#