SN Blog

How to build Enterprise Architecture for your next project?

☕ 4 min read 415

How to build Enterprise Architecture for your next  project?

Last a few weeks, I was thinking how can I build an enterprise architecture for my project so I searched a lot about it. There are many ways you can structure your app in effective way. You might have heard about All-in-one architecture, N-Layer Architecture, Microservices and so on. All of them are good in a certain situation but the architecture that I liked most is Clean Architecture. This pattern is proposed by Uncle Bob in his book as a way of building flexible and maintainable software solutions. So I decided to use and extend this template. The solution template consists of 5 layers. I will show you a C# implementation for ASP Net Core applications. You can find a link to the source code at the bottom of the page.

Core Layer

The Application Core holds the business model, which includes entities, services, and interfaces. These interfaces include abstractions for operations that will be performed using Infrastructure, such as data access, file system access, network calls, etc. Sometimes services or interfaces defined at this layer will need to work with non-entity types that have no dependencies on UI or Infrastructure. These can be defined as simple Data Transfer Objects (DTOs).

Infrastructure Layer

It typically includes data access implementations. In a typical ASP.NET Core web application, these implementations include the Entity Framework (EF) DbContext, any EF Core Migration objects that have been defined, and data access implementation classes. The most common way to abstract data access implementation code is through the use of the Repository design pattern.

Web Layer

The web layer in an ASP.NET Core MVC application is the entry point for the application. This project should reference the Application Core project, and it's types should interact with Infrastructure strictly through interfaces defined in Application Core. No direct instantiation of or static calls to the Infrastructure layer types should be allowed in this layer.

Tests Layer

This layer is for testing. Here you can test all others layers by writing both Unit Tests and Integrational tests. In this way you guarantee that your project has lower chance of bugs.

Common Layer

This layer is for global constants or files that are used in others layers.

If you want to see the source code of the template you can find it here: https://github.com/Svetloslav15/ASP.NetCore-Template If you like It, please consider giving me a star. Thank you!

6 Comments

  • Svetloslav

    7/4/2020

    Thank you Sedric!

  • Cedric_san

    7/4/2020

    Good effort..keep it up..

  • Svetloslav

    6/4/2020

    Alex, glad you liked it, I hope its useful. 💻

  • Svetloslav

    6/4/2020

    Vivek, I am very joyful you like my work. More interesting topics are on the way 😁🔜

  • The Teen Programmer (Alex)

    6/4/2020

    Svetoslav, A great post, I will read your posts in the future to support you. I have a blog of my own which you already know about but if you would like the link again it is theteenprogrammer.co.uk How do you have such good blogging skills? I am amazed!! It was a very good read and I hope other readers enjoy too!

  • Vivek Naskar

    6/4/2020

    This is excellent work. Keep up the good work. Vivek (@thedeveloperstory)

Add a comment