Link to home
Start Free TrialLog in
Avatar of HelpSunny
HelpSunny

asked on

How to invoke a cs file in C#?

I have different modules for Business Layer, DataLayer, Business Entities layer.
Business Layer --> Contains cs files that contains the Business Logic
Business entities --> Contains cs files that contains attributes
Data Layer --> Contains the cs files that interacts with the DB. The results from this layer will be used to set the Entities attributes values in the Business Layer cs files
                         Now my requirement is, In the above existing modules{Solution}, I included a new set of independent files in each module. So, I have to invoke the file that I created in Business layer. I have to invoke a method inside the cs file by hardcoding the parameters. Please let me know on how can I implement this.
                         As in java, is there something called as main method in C#, so that I can diredtly execute the cs file, similar to java like, giving "java ClassName Parameters"
Avatar of magicdlf
magicdlf

In C#, you need to create a new project and put your main there. Then you can include your Business layer by adding reference to your project. This should be very easy for you if your middle layer is a class library project.
Otherwise, you will need to write the csc command line by yourself, which is not integrated with Visual Studio and I dont recommend you to do that.
You can create class in DataLayer, Business Entities layer.
Then call them by putting "using" keyword at the top of the cs file.
ASKER CERTIFIED SOLUTION
Avatar of alain_tesio
alain_tesio

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HelpSunny

ASKER

Thank U