To find controller classes at runtime, you can write an assembly converter, for example:
public class MyAssembliesResolver : DefaultAssembliesResolver { public override ICollection<Assembly> GetAssemblies() { List<Assembly> assemblies = new List<Assembly>(base.GetAssemblies()); // Add all plugin assemblies containing the controller classes assemblies.Add(Assembly.LoadFrom(@"C:\Plugins\MyAssembly.dll")); return assemblies; } }
Then add this line to the Register method in WebApiConfig .
config.Services.Replace(typeof(IAssembliesResolver), new MyAssembliesResolver());
In this case, the request will still need to be sent to a separate controller, even if the controller classes can come from assemblies in the plugin folder. For example, if MyAssembly.dll in the plugins folder contains CarsController , the URI to click on this controller will be / api / cars.
Badri
source share