Skip to content

racsus/WhiteLabelAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web API Template

Set of definitions and protocols that will be use to develop and integrate Web API application software.

Starting 🚀

This document will allow you to understand the architecture of this project. I have used basic authentication to build this project, but It's highly recommended that you change this authentication by another more secure like OAuth2.

Pre-requirements 📋

To execute this project you will need the following packages installed in your computer:

  1. Visual Studio 2019
  2. NET Core 3.1

Arquitecture

This project is splitted in diferent layers using the Clean Architecture methodology described here (https://docs.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/common-web-application-architectures). Here you can find an explanation of each layer:

  1. WhiteLabelAPI.WebAPI: It contains the API controllers. Don't add business logic here. API credentials and connection string database will be in the apisecuritysettings.json and connectionstrings.json files.
  2. Core: It contains the business logic: Entities, Services, DTOs, etc.
  3. Infrastructure.Data: It contains the data layer (Repositories).
  4. Infrastructure.Migrations: It contains the nuget package Microsoft.EntityFrameworkCore.Tools necessary to be able to execute the EF CodeFirst commands like Add-Migrations, Update-Database, etc.
  5. Infrastructure.DependencyBuilder: It contains all the dependecy injections. If you add a new service or repository class, you will need to add the injection here.

Good practices

If you are going to add some code to this project, it's very important that you follow these rules:

  1. Apply the SOLID principles: SRP, OCP, LSP, ISP and DIP.
  2. Leblanc’s law: Later equals never. If you see a mess, fix it.
  3. The Boy Scout rule: “Leave the campground cleaner than you found it”.
  4. The Stepdown rule: Each function introduces the next.
  5. The Einstein rule: Make it as simple as possible but not simpler.
  6. Names mean one thing and only one thing.
  7. Single level of abstraction. One method, one thing.
  8. Comments are to compensate our failure to express ourself in code.
  9. Demeter's law: Do not accept candies from strangers
  10. Murphy's law: If something can go wrong, it will. (Be pessimistic)

Entity Framework Code First Migrations

To be able to execute the EF commands you will need to follow these steps:

  1. Select project Infrastructure.Migrations as startup project in solution explorer.
  2. Open console packet manager (PM) and select Website.Infrastructure.Data as default project.
  3. Add-Migration <name_migration>
  4. Update-Database

Testing ⚙️

TODO. In this section we'll explain how to execute the Unit Tests defined in this project.

Deployment 📦

TODO. Pending to add information.

Authors ✒️

About

Web API white label using .NET CORE 3.1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages