DNTFrameworkCore as a Lightweight Infrastructure

5th March 2019 Off By binary
trading bonus no deposit
Photo from pexels.com

DNTFrameworkCore is a Lightweight and Extensible Infrastructure for Building High Quality Web Applications Based on ASP.NET Core and has the following goals:

  • Common structures in various applications like Cross-Cutting Concerns and etc
  • Follow DRY principle to focus on main business logic
  • Reduce the development time
  • Less bug and stop bug propagation
  • Reduce the training time of the new developer with low knowledge about OOP and OOD
Blog Entity CRUD API
Blog Entity CRUD Service

Features

This Framework has the various features that I list them in below:

  • Automatic Input Validation and Business Validation
  • Automatic Transaction Management
  • Eventing
  • Aggregate Update (Master-Detail) with TrackingState mechanism
  • Automatic Numbering
  • Functional Programming Error Handling instead of using exception for flow control
  • Dynamic Permission Authorization
  • CrudService
  • CrudController
  • DbLogger Provider
  • Auditing
  • DataProtectionKeys DbRepository
  • Name-Value Setting Management
  • Hooks
  • SoftDelete
  • MultiTenancy
  • Tracking mechanism (CreatorUserId,CreationDateTime,LastModifierUserId,…)
  • FluentValidation Integration
  • BackgroundTaskQueue
  • CQRS (coming soon)
  • EntityHistory (coming soon)

Installation

To create your first project based on DNTFrameworkCore you can install the following packages:

PM> Install-Package DNTFrameworkCore
PM> Install-Package DNTFrameworkCore.EntityFramework
PM> Install-Package DNTFrameworkCore.EntityFramework.SqlServer
PM> Install-Package DNTFrameworkCore.Web
PM> Install-Package DNTFrameworkCore.Web.EntityFramework
PM> Install-Package DNTFrameworkCore.FluentValidation
PM> Install-Package DNTFrameworkCore.Web.MultiTenancy

OR

1- Run the following command to install a boilerplate project template based on ASP.NET Core Web API and DNTFrameworkCore:

dotnet new --install DNTFrameworkCoreTemplateAPI::*‌‌

2- Create a new project with installed template:

dotnet new dntcore-api

Now you have a solution like below that contains complete identity management features including user,role and dynamic permission management and also integrated with persistent JWT authentication mechanism:

Multi Project Solution

Introducing various projects in installed template

Domain project contains “Domain Model” of your application. For example, anemic domain model of identity management system was designed in this template.

Infrastructure project contains DbContext, Mapping and EF Core Migrations.

Application project contains DTOs/Models that related to domain entities, validators, application services and event handlers.

Resources project contains resx files.

UnitTests project contains unit tests for your application. for example, you can see UserValidatorTests and RoleValidatorTests results in the following picture:

IntegrationTests project contains integration tests for your application. for example, you can see RoleServiceTests and UserServieTests results in the following picture:

API project contains Controllers, Hubs and JWT authentication infrastructure. as example, you can see RolesController, UsersController and AuthController in the following picture:

In the end, if this infrastructure was useful, share it.


DNTFrameworkCore as a Lightweight Infrastructure was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.

social trading binary options