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