【发布时间】:2020-10-15 09:49:18
【问题描述】:
namespace EmployeeService.Controllers
{
public class EmployeeController : ApiController
{
public IEnumerable<Customer> Get()
{
using (Test_DBEntities test = new Test_DBEntities())
{
return test.Customers.tolist();
}
}
}
}
注意:EmployeeDataAccess.Test_DBEntities:using 语句中使用的类型必须可隐式转换为 System.IDisposable。
【问题讨论】:
-
请正确格式化您的代码,click here to learn how。
-
寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定的问题或错误以及重现它所需的最短代码在问题本身。没有清晰的问题陈述的问题对其他读者没有用处。请参阅:How to create a Minimal, Reproducible example。
-
标题不是您帖子的一部分。标题应该总结您的问题,但帖子本身必须在没有标题的情况下有意义。