IT:AD:WebActivator

Summary

This attribute allows you to have code run way early in the ASP.NET pipeline as an application starts up, even before Application_Start.

To use this attribute, create a class library and add this attribute as an assembly level attribute.

A common place to add this would be in the AssemblyInfo.cs class within the Properties folder.

The ASP.NET one allows only one per Assembly. WebActivator improves on the concept.

Process

[assembly: WebActivator.PreApplicationStartMethod(typeof(MyApp.App_Start.NinjectWebCommon), "Start", Order=1]


[assembly: WebActivator.PreApplicationStartMethod(typeof(MyApp.App_Start.BGScheduler), "Start", Order=2]

THere's also (instead of) the following:

[assembly: WebActivator.PostApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "CallMeAfterAppStart")]

Resources