I’m creating a small application that I will distribute via NuGet. My web app is using Structuremap for DI and in my global.asax I have this snippet:
protected void Application_EndRequest() {
ObjectFactory.ReleaseAndDisposeAllHttpScopedObjects();
}
is it possible to hook this up in another way without modifying the global.asax?
You could write an HttpModule which could be registered in web.config:
and in web.config:
Another, more MVCish way would be to write a global action filter:which could be registered in the
RegisterGlobalFiltersmethod ofGlobal.asax: