阅读背景:

如何正确地处理对象(ASP)。NET MVC +实体框架)

来源:互联网 

I would like to know how to dispose objects correctly in the following situation. This is a ASP.NET MVC controller action. There is a repository which implements IDisposable. Attachment entity contains related entity Task. When I click on the attachment detail, it is displayed correctly. But when I click on the task, then the following exception is threw "The ObjectContext instance has been disposed...". I understand, that when the view is rendered it is disposed and the ObjectContext is closed. I would like to know how to dispose objects cor




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: