Take the 2-minute tour ×

I am creating a plugin system for my ASP.NET MVC Application using Spring.Net IOC Framework. I have placed my Controllers in a different assembly, I need to add these controllers to Spring.Net Application context dynamically.

Please guide me !!

I am trying to implement plugin system like following article but I want to use Spring.Net instead of Autofac.


share|improve this question
what kind of problem do you have? –  jgauffin May 8 '13 at 10:00
add comment

1 Answer

I have used Spring.Net and in it i've accessed Repository objects using Application Context Try this

IApplicationContext ctx = ContextRegistry.GetContext();
            dynamic controller= ctx.GetObject("MyController");

where MyController is the ID of conttoller that you've defined in your controller.xml file

   id="MyController "
   type="Swapeteria.Web.Controllers.ItemPostController, Swapeteria.Web"
        <constructor-arg name="repository" ref="ItemRepository" />
        <constructor-arg name="bookRepository" ref="BookRepository" />
        <constructor-arg name="authorrepository" ref="authorRepository" />
        <constructor-arg name="publisherRepository" ref="PublisherRepository" />
        <constructor-arg name="itemMapper" ref="itemMapper" />
share|improve this answer
-1 and the explanation why: stackoverflow.com/questions/6277771/… –  Andreas Jan 26 '13 at 22:57
add comment

Your Answer


