0

I want to build an web application(ASP.NET MVC 6) that can add modules/plugins without having to rewrite my source code.

Already read about MEF and Areas but are not helping much.

Someone who has overcome this problem that can help me?

1 Answers1

0

Depends on which part of the web application you are targeting.

1.If it's in the request pipeline you would make a Middleware package.

2.It's it's in HTML you would make a TAG Helper package.

3.If it's an intrinsic functionality you would extend appropriate classes and throw them into a package. An example of this would be helpful extension methods or methods to add claims given a claims principal.

4.If you want to go even further you could create your own Visual Studio templates that you can use to pre-fill your options upon creation.

Muqeet Khan
  • 2,094
  • 1
  • 18
  • 28
  • I developed a mvc 6 web api in a visual studio solution and a Class Library in another vs solution. In that Library i created a controller and I'm trying to access it in the web api. I already referenced the Class Library in the web api but when I run it, I can't access the Library controller. – Francisco Pereira Feb 25 '16 at 09:00
  • I would recommend using the logic of that controller as a service. Using controller from another library is not the way although if the other controller inherits from controller and provided you have proper routing configured it should work. Views is what will give you issues, Because MVC by default looks into the view folder for views. – Muqeet Khan Feb 25 '16 at 11:35
  • I think I have proper routing configured because I also created a Class Library in the visual studio solution's where the web api is and it works fine, I can access that Library's controller. If I add the following code to Startup.cs I can access the external controller: ` services.AddMvc().AddControllersAsServices( new[] { typeof(ClassLibrary2.GlinttController).GetTypeInfo().Assembly, }); ` GlinttController is my external controller. But if I add this code I can't longer access the web api's controller. – Francisco Pereira Feb 25 '16 at 12:35