English 中文(简体)
ASP.NET 4中的PreApplicationStartMethod是一件好事吗?
原标题:Is the PreApplicationStartMethod in ASP.NET 4 a good thing?

Disclaimer: This is the first time I am asking a question that might be classified as subjective. As English is not my first language, it is hard to phrase this right. So please feel free to edit the question in order to make it clearer, or to point me at other ways for asking this.

Intro: David Ebbo (architect on the ASP.NET team) just posted on Register your HTTP modules at runtime without config using the seemingly undocumented PreApplicationStartMethod assembly level attribute

我对此百感交集。

一方面,能够在应用程序启动阶段尽可能早地进行操作是件好事。

另一方面:这足够吗?我们是否需要PrePreApplicationStartMethod来篡改PreApplicationStartMethod行为?扩展到非汇编用途(例如,NuGet已经围绕PreApplicationStartMethod的每次使用程序集限制工作)?

问题:除了将其用于无配置启动之外,您认为PreApplicationStartMethod属性如何?

最佳回答

我认为它的一个好用法是,它允许正在编写第三方程序集的人,或者正在编写将在许多项目中使用的程序集的团队,能够使用此属性来初始化东西,而不需要最终用户/开发人员在应用程序启动事件中在global.asax中创建任何东西。

人们喜欢/需要在global.asax中配置许多特定于应用程序的东西,但如果你正在创建一个DLL,你就不必再让用户在global.asax中配置你的类了,你可以把所有的逻辑都放在你自己的init/bootstrap函数中,并在应用程序启动时依靠asp.net来调用你的init逻辑。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!