WebActivator & startup order

Apr 7, 2011 at 9:42 AM

Hi guys,

We run into a problem with EF Prof nuget package. Basically, we need to execute the EF Prof startup before any EF calls. 

It turns out that when EntityFramework.SqlServerCompact package was installed, it added an App_Start call:

   Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");

And that one caused us issues.

Right now, it seems that the order of web activator calls is pretty much random, but they has got to be a way to set this up.

As I see it, there are going to be two crowds here:

* I wanna be first

* I don't care

The problem occurs when you have two packages that want to be first, but that can be resolved by the user manually.


Apr 7, 2011 at 10:46 PM

Tricky issue. I knew it'd be a problem at some point, but this is the first time that it actually is a problem for a concrete scenario :)

We could add some optional 'priority' enum with values like Low, Normal, High, but that's a tough choice to put the package author in front of.

Note that in a way, we already have this in the sense that you can choose between the PreApplicationStartMethod and PostApplicationStartMethod attributes. In fact, I think that EntityFramework.SqlServerCompact would work fine as a PostStart method. As a test, could you try changing the attribute for the EntityFramework.SqlServerCompact startup code to PostApplicationStartMethod and see how that goes?

If it all works well, we can consider re-releasing that package with that change. I would say that authors should use Post unless they have a valid reason to go with Pre (though I think most are using Pre today as Post support was added more recently).

Jun 22, 2011 at 3:04 PM
Edited Jun 22, 2011 at 3:11 PM

hello David Ebbo,


                  how can i modify my Web.config using the start up code from web activator? 'It is because i have to change my web.config at runtime', i have tried a lot things, but no success. Can you help me with this? Thank you.

Jun 22, 2011 at 11:55 PM

Generally, modifying web.config at runtime is tricky, because it causes the App Domain to shut down. Web Activator has no special support for modifying web.config, though it's probably something that can be done (e.g. via XML API's). But the behavior may not be what you want.

As an aside, it's best to start new thread for new topics to avoid causing confusion between the original question and the new question :)

Jul 19, 2011 at 12:11 AM

I just filed this WebActivator bug to track this. The idea is that we can look at the assembly dependency graph to infer ordering automatically. This will cover most scenarios, and will not put any burden on the end user.