Implementation of REST API in .NET Core C#. Based on the following steps:
- Installing and configuring Swagger
- Scaffolding dbcontext from the used database (MySql in this example) and configuring the needed connections (see Database.sequelmovieContext, appsettings.json, Startup.cs)
- Installing AutoMapper and creating a class which inherits Profile (see Mapper->Mapper.cs)
- Creating a Model class library with models that are equivalent to the ones in the database (no objects or collections, only include foreign keys)
- Creating Requests for each model (Search requests are parameters used for filtering results on the API side, Upsert requests are equivalent to the models - if the primary key is autonumber exclude the primary key property)
- Creating the IService and ICRUDService and implementing them in BaseService and BaseCRUDService with the adequate dbcontext
- Creating a service class for each model which inherits the BaseCRUDService
- Creating maps for each model in Mapper.cs (Database.Model -> Model.Model and Database.Model -> UpsertRequest.ReverseMap, see Mapper.cs)
- Overriding methods if needed
- Creating BaseController and BaseCRUDController and inheriting the needed services (see Controllers)
- Creating a controller for each model and inheriting the BaseCRUDController (see Controllers.ArtisteController)
- Configuring the dependency injections using Scoped type (see Startup.cs)