A RESTful Web API project built with ASP.NET Core 10, following the Ultimate ASP.NET Core Web API course by CodeMaze.
This project is currently in development and implements features up to Part 15 of the course.
This is a comprehensive Web API solution demonstrating modern ASP.NET Core development practices, including:
- Layered Architecture - Separation of concerns across multiple projects
- Repository Pattern - Data access abstraction
- Service Layer - Business logic implementation
- Entity Framework Core - ORM for database operations
- AutoMapper - Object-to-object mapping
- NLog - Structured logging
- Content Negotiation - XML, JSON, and CSV output formatters
- Action Filters - Request validation
- Global Error Handling - Centralized exception management
CompanyEmployees/
├── CompanyEmployees # Main Web API project
├── CompanyEmployees.Presentation # Controllers and presentation layer
├── Service # Business logic implementation
├── Service.Contracts # Service interfaces
├── Repository # Data access layer
├── Contracts # Repository interfaces
├── Entities # Domain models and configuration
├── Shared # DTOs and shared utilities
└── LoggerService # Logging implementation
- .NET 10
- ASP.NET Core Web API
- Entity Framework Core 10.0.1
- SQL Server
- AutoMapper 16.0.0
- NLog 6.1.0
- Custom CSV Output Formatter
- .NET 10 SDK
- SQL Server
- Visual Studio 2022 or later (or VS Code)
-
Clone the repository
git clone [repository-url] cd CompanyEmployees -
Update the connection string in
CompanyEmployees/appsettings.json"ConnectionStrings": { "sqlConnection": "Server=YOUR_SERVER; Database=CompanyEmployees; Trusted_Connection=true; TrustServerCertificate=true;" }
-
Apply database migrations
dotnet ef database update --project CompanyEmployees
-
Run the application
dotnet run --project CompanyEmployees
The API will be available at
https://localhost:5001(or the port specified inlaunchSettings.json).
- ✅ Onion Architecture setup
- ✅ Dependency Injection configuration
- ✅ Logger service integration with NLog
- ✅ Repository pattern implementation
- ✅ SQL Server configuration with EF Core
- ✅ GET, POST, PUT, DELETE operations
- ✅ Content negotiation (JSON, XML, CSV)
- ✅ Custom CSV output formatter
- ✅ Global error handling middleware
- ✅ AutoMapper configuration for DTOs
- ✅ Action filters for validation
- ✅ Model validation with data annotations
- ✅ Asynchronous operations
- ✅ HTTP PATCH with JSON Patch Document
- ✅ Company and Employee management endpoints
GET /api/companies- Get all companiesGET /api/companies/{id}- Get company by IDPOST /api/companies- Create a new companyPUT /api/companies/{id}- Update a companyDELETE /api/companies/{id}- Delete a company
GET /api/companies/{companyId}/employees- Get all employees for a companyGET /api/companies/{companyId}/employees/{id}- Get employee by IDPOST /api/companies/{companyId}/employees- Create a new employeePUT /api/companies/{companyId}/employees/{id}- Update an employeePATCH /api/companies/{companyId}/employees/{id}- Partially update an employeeDELETE /api/companies/{companyId}/employees/{id}- Delete an employee
The API supports multiple response formats:
- JSON (default):
Accept: application/json - XML:
Accept: application/xml - CSV:
Accept: text/csv(for Company endpoints)
This project follows the Onion Architecture pattern with clear separation of concerns:
- CompanyEmployees - Entry point, configures services and middleware
- CompanyEmployees.Presentation - API controllers
- Service / Service.Contracts - Business logic layer
- Repository / Contracts - Data access layer
- Entities - Domain models and EF Core configuration
- Shared - DTOs for data transfer
- LoggerService - Cross-cutting logging concern
This is a learning project following the CodeMaze Ultimate ASP.NET Core Web API course.
- CodeMaze - Ultimate ASP.NET Core Web API Course
- ASP.NET Core Documentation
- Entity Framework Core Documentation
Note: This project is for educational purposes and is actively being developed as I progress through the course.