views:

139

answers:

0

Hi there,

I have an ASP.NET Web Forms app using Entity Framework in the data layer. I've recently changed the app over to use one Object Context per request as per this post. It works great for the entire application except for any page which uses a ReportViewer to display something.

I've noticed that it fails when trying to get an instance of the ObjectContext from the HttpContext.Current.Items collection because HttpContext.Current is null. Microsoft.ReportViewer.WebForms.dll and Microsoft.ReportViewer.Common.dll can also be seen in the call stack each time it fails. The reports each use one or more ObjectDataSources to retreive data.

Based on this I'm assuming that the ReportViewer is somehow to blame, but i have no idea why. I would need some way to dispose the ObjectContext after it had been used by the report at the very least.

Cheers.