[英]can anyone help me i have problem with this message below
namespace EmployeeService.Controllers
{
public class EmployeeController : ApiController
{
public IEnumerable<Customer> Get()
{
using (Test_DBEntities test = new Test_DBEntities())
{
return test.Customers.tolist();
}
}
}
}
Note: EmployeeDataAccess.Test_DBEntities
: type used in a using
statement must be implicitly convertible to System.IDisposable
.注意: EmployeeDataAccess.Test_DBEntities
:在using
语句中使用的类型必须隐式转换为System.IDisposable
。
Your Test_DBEntities
does not implement the System.IDisposable
so you cannot put it in the using statement, remove it and the error will be gone.你的Test_DBEntities
没有实现System.IDisposable
所以你不能把它放在 using 语句中,删除它,错误就会消失。
namespace EmployeeService.Controllers {
public class EmployeeController: ApiController {
public IEnumerable Get() {
Test_DBEntities test = new Test_DBEntities();
return test.Customers.tolist();
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.