Skip to content

This is a clean architectural Template for visual studio to start a new project with clean architecture!

Notifications You must be signed in to change notification settings

i-radi2/Clean-Architecture-MS2-Template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Clean architecture template for Visual Studio

In this repository I have prepared a clean architectural Template for visual studio so you can start your project very quickly with clean architecture!

image

Get Started!

1. Download zip file of lastest release : link

2. Go to Documents\Visual Studio Version\Templates\ProjectTemplates\Visual C# and paste zip file :

image

3. Go to visual studio -> create new project dialog You will see the newly created template as shown below.

image

4. Create new project :

image

Review of architecture and layering

Clean Architecture MS2

Common Layer

In this layer there are tools and classes that perhaps they be used in All layers . Actually this layer has nothing to do with project subject and utilities of this layer help us to Improve codding and prevents duplication of classes or methods. In this layer we have :

  • PersianDate.cs
  • Resources : *.resx
  • SeparationMoney.cs
  • StringExtensions.cs
  • SecutrityHelper.cs

Also, according to the definition of this layer, shared libraries are located in this area. you can more study about shared libraries in this link

Domain Layer

This will contain all entities, enums, exceptions, interfaces (Interfaeces of repository), types and logic specific to the domain layer.

Domain.Core Layer

Also in this layer we have some base classes for example :

  • Settings file
  • BaseEntity.cs
  • BaseEvent.cs
  • BaseMessage.cs
  • LifieTime interfaces

Application Layer

Application layer contains business logic and types :

  • Application Interfaces
  • View Models / DTOs
  • Mappers
  • Application Exceptions
  • Validation
  • Logic

This is the Application of your Domain use to implement the use cases for your business. This provides the mapping from your domain models to one or more view models or DTOs. Validation also goes into this layer…

Infrastructure Layer

  • Database
  • Web services
  • Files
  • Message Bus
  • Logging
  • Configuration

The Infrastructure Layer will implement interfaces from the Application Layer to provide functionality to access external systems. These will be hooked up by the IoC container, usually in the Presentation Layer. The Presentation Layer will usually have a reference to the Infrastructure Layer, but only to register the dependencies with the IoC container. This can be avoided with IoC containers like Autofac with the use of Registries and assembly scanning

Webframework Layer

In this layer we have everything that is about the configurations of the Presentation layer framework :

  • ApiResult.cs
  • Middlewares
  • Filters
  • Asp.net core config …

Presentation Layer

  • MVC Controllers
  • Web API Controllers
  • Swagger / NSwag
  • Authentication / Authorisation

The Presentation Layer is the entry point to the system from the user’s point of view.

About

This is a clean architectural Template for visual studio to start a new project with clean architecture!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%