Is PreApplicationStartMethod in ASP.NET 4 a good thing?

Disclaimer: This is the first time I ask a question that can be classified as subjective. Since English is not my first language, it is difficult to correctly formulate this right. So please feel free to edit the question to make it clearer, or point me in another way to ask it.

Introduction: David Ebbo (an architect from the ASP.NET team) just posted on Register your HTTP modules at run time without configuration , using the seemingly undocumented assembly level attribute PreApplicationStartMethod

I have mixed feelings about this.

On the one hand, it’s good to be able to do things as early as possible at the application launch stage.

On the other hand: is it enough? Do we need a Pre PreApplicationStartMethod that allows us to tinker with the behavior of PreApplicationStartMethod? As for the extension for use without assembly (for example, NuGet already works with one-time restrictions in PreApplicationStartMethod)?

Question. How do you feel about the PreApplicationStartMethod attribute besides using it to run without configuration?

+4
source share
1 answer

I think that one of the good conditions for this is that it allows someone to write a third-party assembly or a team that works on the assembly that will be used in many projects to be able to use this attribute to initialize the material without the need so that the end user / developer creates something in global.asax in application launch events.

There are many applications in the global.asax application that need to be configured / need to be configured, but if you create a DLL you no longer need to configure users for your classes in global.asax, you can just put all your logic in your own init / bootstrap function and rely on asp.net to invoke the initialization logic when the application starts.

+2
source

Source: https://habr.com/ru/post/1339616/


All Articles