Currently, my MVC 3 app has a dependency on a static class that is initialized in the Application_Start() like this:
protected void Application_Start()
{
MyDependency.Initialize();
}
With the static class looking more or less like the following:
public static class MyDependency
{
public static void Initialize()
{
// Perform some I/O...
}
}
This dependency is used in an attribute class, which comes with the caveat of having no run-time dependencies (hence the call to initialize in the Application_Start())
public class MyAttributeClass : ...
{
public MyAttributeClass()
{
MyDependency.DoSomething(); //...
}
}
Ultimately, other developers in our shop will have to use this API, and I'd like to see if there's a way to get rid of the line in the Application_Start() (an extra line of code in the Global.asax is likely to be a forgotten step)
For instance, is there a way the MyDependency class can "hook" into the pipeline without the needing to edit the Global.asax?