1

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.

http://www.codeproject.com/Articles/386674/ASP-NET-MVC-3-plug-in-architecture-using-Griffin-M

Prachetas
  • 43
  • 5

1 Answers1

-1

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

<object
   id="MyController "
   type="Swapeteria.Web.Controllers.ItemPostController, Swapeteria.Web"
   singleton="false">
        <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" />
    </object>
Syed Salman Raza Zaidi
  • 2,172
  • 9
  • 42
  • 87
  • -1 and the explanation why: http://stackoverflow.com/questions/6277771/what-is-a-composition-root-in-the-context-of-dependency-injection – Andreas Jan 26 '13 at 22:57