c# - Handling a dependancy from different project in a console application -


i have following project structure in solution:

project.repository (class library)

project.core (class library)

project.web (mvc5 web front end)

project.scheduler (console application)

i using unity handle di.

my problem

i have method sits in core layer, method has dependency on iprocessdataservice interface being handled in unity config.

    //service                 container.registertype<iprocessdataservice, processdataservice>(new perrequestlifetimemanager()); 

i have created console application project invoke said method , run on windows schedule.

how go accessing method console application's static main method considering have dependency core interface?

public class program     {         public static void main(string[] args)         {             console.writeline("begin automation process");              //run method core layer has dependency on iprocessdataservice          }     } 

your console app's main method composition root , should doing of wiring in there.

then can resolve object container , call method on it.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -