AspNetDependencyInjection icon indicating copy to clipboard operation
AspNetDependencyInjection copied to clipboard

Consider replacing WebActivatorEx.PreStart with System.Web.PreApplicationStart

Open daiplusplus opened this issue 6 years ago • 3 comments

While researching OWIN for this: https://github.com/Jehoel/AspNetDependencyInjection/issues/6 I saw this: https://docs.microsoft.com/en-us/dotnet/api/system.web.preapplicationstartmethodattribute?view=netframework-4.8

Phil Haack mentioned it here: https://haacked.com/archive/2010/05/16/three-hidden-extensibility-gems-in-asp-net-4.aspx/

I need to find out if it's worth ditching WebActivatorEx for this approach as it means we can remove another NuGet dependency - but is it worth it? Might some users prefer it one way or another?

daiplusplus avatar Aug 17 '19 00:08 daiplusplus

From what I have found, WebActivatorEx has some extra functionality that the attributes in System.Web don't provide. From what I quickly saw in the WebActivatorEx, it handles design time stuff as well as configuration via specifically named appsettings values. And it builds on top of the built in System.Web attributes.

I also want to say that, in my experience, something didn't work right when I used the built in System.Web attributes, while WebActivatorEx worked, though I may be mistaken. If your goal is to remove the nuget dependency, make sure it works well first.

Also, if other people want to use the WebActivatorEx instead, it is something they can easily add themselves, as all they would need to do is install the nuget package directly for their project (if it isn't being pulled in by some other dependency) and include a using WebActivatorEx or prefix the attribute with WebActivatorEx.

TheJayMann avatar Aug 17 '19 01:08 TheJayMann

Btw @TheJayMann would you like me to add you as a member of this repo?

daiplusplus avatar Aug 17 '19 01:08 daiplusplus

If you see a benefit to it, I wouldn't be against it.

TheJayMann avatar Aug 17 '19 01:08 TheJayMann