c# - Can i use ApiControllers from a library project in my solution? -
I have two solutions in one project, one with a full API and one another (one library) of my API controllers with . Is there any easy way to use API controllers from my library in my Web API project?
Yes, in web API you can create a custom Or if you do not want to load DLL by hand Then you register your httpconfiguration.Services.Replace (typeof (IAssembliesResolver) New customsabband resistor ()); More info: IAssembliesRolver .
The public class can use the controllers of external assemblies by providing custom reseller roles: the default asymmetrical reseller {public override iscollchen & lt; Assembly & gt; GetAssemblies () {var assemblies = base.getsassemilease (); Variable Controller Assembly = Assembly.LoadFrom (@ "C: \ PATH_TO_MY_CONTROLLERS_ASSEMBLY"); Assemblies.Add (controllersAssembly); Return legislatures; }}
public class customsabangersolver: default asymbly reseller {public override icon selection & lt; Assembly & gt; GetAssemblies () {var assemblies = base.getsassemilease (); Var Controller Aspaid Folder = Typef (SomeTypeFromControllersLibrary) Assembly; Assemblies.Add (controllersAssembly); Return legislatures; }}
http configuration :
Comments
Post a Comment