Set of definitions and protocols that will be use to develop and integrate Web API application software.
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.
To execute this project you will need the following packages installed in your computer:
- Visual Studio 2019
- NET Core 3.1
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:
- 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.
- Core: It contains the business logic: Entities, Services, DTOs, etc.
- Infrastructure.Data: It contains the data layer (Repositories).
- 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.
- 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.
If you are going to add some code to this project, it's very important that you follow these rules:
- Apply the SOLID principles: SRP, OCP, LSP, ISP and DIP.
- Leblanc’s law: Later equals never. If you see a mess, fix it.
- The Boy Scout rule: “Leave the campground cleaner than you found it”.
- The Stepdown rule: Each function introduces the next.
- The Einstein rule: Make it as simple as possible but not simpler.
- Names mean one thing and only one thing.
- Single level of abstraction. One method, one thing.
- Comments are to compensate our failure to express ourself in code.
- Demeter's law: Do not accept candies from strangers
- Murphy's law: If something can go wrong, it will. (Be pessimistic)
To be able to execute the EF commands you will need to follow these steps:
- Select project Infrastructure.Migrations as startup project in solution explorer.
- Open console packet manager (PM) and select Website.Infrastructure.Data as default project.
- Add-Migration <name_migration>
- Update-Database
TODO. In this section we'll explain how to execute the Unit Tests defined in this project.
TODO. Pending to add information.
- Oscar Rodríguez - Responsible for define the project arhitecture. https://www.linkedin.com/in/oscar-rodriguez-lopez-70b2a337/