Use PreApplicationStartMethodAttribute and cattribute
The first time I saw this thing in my company's framework, I was quite depressed at the beginning. I had nothing in Application_Start of the framework, and I found the PreApplicationStartMethodAttribute through some clues.
Here is a simple record.
1. Role
Specify a function to be executed before the site's Application_Start.
2. Usage
[Assembly: PreApplicationStartMethod (typeof (SomeClassLib. Initializer), "Initialize")]
It is generally stored in AssemblyInfo. cs.
You can register multiple instances.
3. Purpose
It allows us to do something out of web. config, such as registering custom IHttpModule, registering BuildProvider.
4. Note
The sequence of the application startup methods defined by the Assembly cannot be guaranteed. Therefore, each registration start method should write the code for separate operation, and should not depend on the side effects of other registration start methods. (From MSDN)