Visual Studio template to create ASP.NET CORE 8 WebAPI with Clean Architecture pattern. The technology stack includes MediatR, AutoMapper, FluentAPI, Entity Framework, Swashbuckle, Linq, and Bogus. The source code includes features such as data filtering, sorting, ordering ...
When utilizing the OnionAPI template to initiate a new project in Visual Studio, it automatically generates a solution comprising five distinct projects. Each project is prefixed with the given project name and boasts its own customizable namespace within the source code. The purposes of these projects are outlined below:
Domain: This project serves as the repository for entities and common models integral to the application.
Application: Within this project, you'll find interfaces, CQRS features, exceptions, and behaviors crucial for the application's functionality.
Infrastructure.Persistence: Home to the data access API, this project is built on Entity Framework, facilitating interaction with the underlying database.
Infrastructure.Shared: This project encompasses common services such as the Mail Service, Date Time Service, Mock, and others that are shared across different components of the application.
WebApi: This project hosts API controllers responsible for exposing REST API resources. Additionally, it provides endpoints accessible via Swagger, allowing for seamless interaction with the API.
The underlying technology stack employs a loosely-coupled and inverted-dependency architecture, incorporating sound design patterns and best practices. Here's a breakdown of the key components:
NET CORE 8: A framework designed for the development of RESTful services (web APIs) using C#, providing a solid foundation for creating scalable and performant applications.
Repository Pattern: This pattern introduces an abstraction layer between the data access layer and the controller, enhancing modularity and maintainability in the application's design.
CQRS (Command and Query Responsibility Segregation) Pattern: This architectural pattern separates read and update operations for a data store, optimizing performance, scalability, and security. Leveraging MediatR and AutoMapper enhances the implementation of this pattern.
Entity Framework Core: A lightweight, extensible, open-source, and cross-platform iteration of the renowned Entity Framework data access technology. It simplifies database interactions within the application.
Swashbuckle: Recognized as an industry standard, Swashbuckle is employed for REST API documentation and testing. It streamlines the process of creating and maintaining comprehensive API documentation.
Bogus: A realistic and user-friendly mock data .NET library, facilitating rapid design and testing of REST APIs. It aids in generating authentic-looking mock data for various scenarios.
Serilog: Serving as a robust solution, Serilog is utilized for logging WebAPI requests and errors. It enhances the monitoring and debugging capabilities of the application by providing detailed logs of requests and errors.