how can i load a dll and assign routing url to methods to use them as webAPI calls?

618 Views Asked by At

i'm writing an application in asp.net core with a set of webAPI defined usig MVC and routing attributes. Now i'd like to manage additionals functions but, as a plugin, i'm going to define them in a external DLL and then load it with

Assembly assemblyPlugin = Assembly.LoadFrom(DLL2load);

This is ok but how can i be able to call its methods as webAPI from anotther application ? May i have to define their routing attributes inside the loaded DLL or to assign them after loading it in the main application? How can i do it ?

1

There are 1 best solutions below

5
CodingMytra On

you can do following,

services.AddControllers() // use AddControllersWithViews for MVC app
        .AddApplicationPart(Assembly.Load(new AssemblyName("DlltoLoad")));