I'm trying to introduce dependency injection into an existing Web Forms application. The project was created as a Web Site project (as opposed to a Web Application Project). I have seen samples where you create your global class in global.asax.cs and it looks something like this:
public class GlobalApplication : HttpApplication, IContainerAccessor
{
private static IWindsorContainer container;
public IWindsorContainer Container
{
get { return container; }
}
protected void Application_Start(object sender, EventArgs e)
{
if (container == null)
{
container = <...>
}
}
But in a web site project, if you ask to add a global class, it adds only global.asax which contains a server-side script tag:
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
There doesn't seem to be a way for me to derive from HttpApplication (and IContainerAccessor) here. Or am I missing something obvious?