Search code examples
c#visual-studiovisual-studio-20153-tier

C# design as 3 layer and implement a layer as a .dll (library)


I'm working on a C# assignment. I have to design my C# application as 3 layer, where the layers have to be implemented in their own packages. To solve this, i just added folders to my project in Visual Studio. Is this the right approach?

Then i have to implement the business logic as a .dll (library). What i have done is to create a new Class Library project in my Solution. What i have right now is:

Screenshot of my Solution Explorer

I'm not sure about how to do this. Is it correctly done? If so, i want to know what to do now. As far as i know, i have to build the Class Library project to get the .dll file, which i can add as reference to the other project. But if i write my business logic in the Class Library project, then what am i supposed to write in my BusinessLogic package in the main project?

If my approach is wrong, please tell me how to solve this.


Solution

  • You need a class library for each layer under your application. You can do as you say and compile the class to get a dll then add the DLL as a reference, however to simplify, add a project reference to each of the class library projects... The compiler will then take care of the DLL references when you build it.