DEV Community

loading...

Clean Architecture for ASP.NET Core

Ushmi Dave
・2 min read

When we are building an RESTful service based enterprise application, at that time we have to cover many things in our base project such as providing high-end security, maintaining performance, capacity, scalability, extensibility, data consistency, validation and that too by following best design practices, proper coding standards and naming conventions. This sounds very clumsy and difficult to maintain🤔.

But here I will show you a solution I have found on visual studio marketplace that fulfills all my software requirements along with OWASP top security standards, with domain driven practices, bounded context pattern, unit of work pattern, CQRS, inversion of control and lot more along with scaffolding many necessary things. Isn’t this interesting😃???

Clean Architecture of AspNetCore API

RxWeb Project template follows the practices of Clean Architecture with good design patterns which can be necessary for any data driven enterprise application.
Let’s quickly see the high level code snippet of by using this architecture libraries.

Clean Architecture

The above code represents implementation of the following features:

  • Data Audit Logging
  • Single Database Multitenant
  • Unique Validation
  • Conditional Validation
  • Centralized Value encryption
  • Value Sanitization
  • Timezone conversion

How To

1) Download and Install

Download and install the template of Clean Architecture of ASP.NET Core from visual studio marketplace

2) Create a New Project

Create a new project by selecting the installed template and check the option of "place solution and folder in same directory" as below:

Create Project

3) Examine The Project Structure

The project structure is divided into several layers of Models, Domain services,Bounded context, Application core and API which adds the practices of seperation of concerns for simplification and maintanable code.

The project solution contains six projects. They are :

Create Project

4) Run The Project

Run the project and test the authentication api. Here is the output of the project
Login Api

Your project is ready for creating and testing web APIs.

Feel free to share your suggestions and comments. You can also share your inputs on gitter channel.

Discussion (0)

Forem Open with the Forem app