How to organize Visual Studio projects2 min read

In my latest Youtube video, I talked about how to organize Visual Studio projects in a Visual Studio blank solution to support multilayered architecture.

Why should you organize your application in a multilayered way?

Well, so your app becomes more robust, easy to upgrade and maintain.

This way you know where and how to look, when adding or fixing some feature of your app.

Basically, your app should consist of several components and in order to implement them, you need to know or be aware of some of the patterns while building applications.

Since I like straight to the point tutorials I will show you how to organize your app when creating Visual Studio projects:

Visual Studio projects breakdown schema
1. Create your main app (whether it’s web api, mobile app, desktop app)

This is basically your main entry. The part of your architecture which is visible to the outside world (users / other systems)

It should be used just as a proxy to forward in/out data.

2. Create your BLL project

The heart of your app, since it contains all of your business logic. This is the place where all magic happens.

I.e.: here we do the business logic stuff and convert DTO to DOMAINCLASSES and vice versa.

3. Create your BLL.Contract project

Place where we define what and how should something be implemented.

4. Create your BLL.Test project

Project responsible for testing your business layer logic.

5. Create your DAL project

Part of the app responsible for pure database manipulation (CRUD). 

I.e.: implementing repositories and unit of work.

6. Create your DAL.Contracts project

Place where we define what and how should something be implemented in data access layer.

7. Create your DAL.Test project

Project responsible for testing your data access layer logic.

8. Create your DOMAINCLASSES project

Here all classes which represent database table structures reside. 

I.e.: type of data which goes into and out of your database.

9. Create your DTO project

Project which contains all data transfered objects which means all classes that go into and out of BLL layer.

10. Create your COMMON project

As the name suggests, it’s a place where all methods or classes which are used in at least two projects, reside.

I.e.: some kind of converters or helper methods.

And now we prepared our project for our multilayered architecture.

Cheers

(Visited 42 times, 1 visits today)

Leave a comment

Your email address will not be published. Required fields are marked *