System.ObjectDisposedException: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection

后端 未结 10 2242
清酒与你
清酒与你 2020-12-01 23:21

I am using EF 4 to retrieve a list of Employees.

public ContentResult AutoCompleteResult(string searchText)
{
    List list = Employee.GetAll         


        
10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 00:04

    I worth taking a look at your Employee object and make sure you don't have any virtual keywords sticking out there. The virtual keyword is interpreted by Entity Framework as 'lazy-load'. We'd need to see your Employee class to make an absolute assertion why you could be seeing the exception.

提交回复
热议问题