Last active
August 29, 2015 14:19
-
-
Save alexeyzimarev/fafb3f6b2311c0e6b647 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Global : HttpApplication | |
{ | |
private static AppHost _appHost; | |
protected void Application_Start(object sender, EventArgs e) | |
{ | |
_appHost = new AppHost(); | |
_appHost.Init(); | |
} | |
protected void Application_BeginRequest(object src, EventArgs e) | |
{ | |
HttpContext.Current.Items.Add("AutofacScope", _appHost.AutofacContainer.BeginLifetimeScope( | |
MatchingScopeLifetimeTags.RequestLifetimeScopeTag)); | |
if (Request.IsLocal) | |
Profiler.Start(); | |
} | |
protected void Application_EndRequest(object src, EventArgs e) | |
{ | |
((IDisposable) HttpContext.Current.Items["AutofacScope"]).Dispose(); | |
Profiler.Stop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment