views:

266

answers:

1

Hi, I am trying to create a bootstrapper with a tasks (for now RegisterRoutes and RegisterControllerFactory) defined in a Spring.Net container. The bootstrapper code is below:

    public static void Run()
    {
        IApplicationContext applicationContext = WebApplicationContext.GetRootContext();
        IDictionary bootstrapperTasks = applicationContext.GetObjectsOfType(typeof(IBootstrapperTask));
        foreach (IBootstrapperTask bootstrapperTask in bootstrapperTasks.Values)
            bootstrapperTask.Execute();
    }

The problem is that if I want to run bootstrapper in a Application_Start method the WebApplicationContext is not available yet - the earliest stage where is available is the Init method.

But as I know the Init method is not a good place to register routes (read at: http://aspnet.codeplex.com/WorkItem/View.aspx?WorkItemId=3325)

Is there any workaround or should I create a bootstrapper manualy (without spring)?

Thanks

A: 

Since i haven't used spring IOC with MVC (using Ninject) this may not help but you could try

IApplicationContext ctx = ContextRegistry.GetContext();

and register your bootstrapper objects in the web.config

http://www.springframework.net/doc-latest/reference/html/objects.html#objects-factory-instantiation

KaraT
No, that that doesn't help...
rrejc