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 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; }}   

Or if you do not want to load DLL by hand

  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; }}   

Then you register your http configuration :

httpconfiguration.Services.Replace (typeof (IAssembliesResolver) New customsabband resistor ());

More info:

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -