w3ti.OpenBaseNET.SQLServer.Template
10.3.5
dotnet new install w3ti.OpenBaseNET.SQLServer.Template@10.3.5
OpenBaseNET SQLServer Template
.NET 10 template for quickly building robust Web APIs with Clean Architecture, DDD, CQRS, and SQL Server.
Starting a new project requires a lot of repetitive setup: structuring layers, configuring data access, defining validation pipelines, wiring up the logger, and so on. This template eliminates that boilerplate. With a single command, you get a complete, production-ready .NET solution — so you can focus on business logic.
Architecture
The template follows Clean Architecture principles with Domain-Driven Design (DDD), organizing responsibilities into independent, testable layers.
MyApi/
├── src/
│ ├── MyApi.Domain # Entities, interfaces, domain services
│ ├── MyApi.Application # Use cases, commands, queries, DTOs
│ ├── MyApi.Infrastructure # EF Core, Dapper, repositories, UoW
│ └── MyApi.API # Controllers, middlewares, Program.cs
└── tests/
└── MyApi.Tests.Unit # Unit tests
| Layer | Responsibility |
|---|---|
| Domain | Business entities, repository interfaces, and domain services. Has no dependencies on any other layer. |
| Application | Use cases via CQRS (commands and queries). Orchestrates the domain without knowing infrastructure details. |
| Infrastructure | Concrete implementations: EF Core, Dapper, Unit of Work, resilience with Polly, Serilog. |
| API | Application entry/exit point: Controllers, global exception handling, Swagger. |
Features
Data Access
- Entity Framework Core 10 with extensions for automatic retry
- Dapper integrated for high-performance SQL queries
- Generic Repository Pattern with support for pagination, filters, and includes
- Unit of Work for transactional control with EF Core + Dapper in the same transaction
CQRS and Mediator
- MediatR 14 for command and query separation
- Pre-configured Pipeline Behaviors:
ValidationBehaviour— runs FluentValidation before any handlerLoggingBehaviour— automatic logging for every processed request
Validation
- FluentValidation integrated into the MediatR pipeline — errors are automatically returned as
422 Unprocessable Entity
Mapping
- AutoMapper configured via dependency injection, with support for
nulldestinations and collections
Resilience
- Polly with an exponential retry pipeline with jitter (3 attempts, 2s initial delay) for:
- SQL Server operations (via Dapper and EF Core)
- HTTP calls
- Azure Storage
Observability
- Serilog with structured JSON output (
CompactJsonFormatter) - Automatic enrichment with machine name and environment name
- Configurable via
appsettings.json - Automatic logging of repository operations (add, update, remove, query, execute)
Exception Handling
- GlobalExceptionHandlerMiddleware with responses following RFC 9457 (ProblemDetails):
ValidationException→422 Unprocessable EntityKeyNotFoundException→404 Not FoundArgumentException→400 Bad Request- All other exceptions →
500 Internal Server Error
API and Documentation
- Swagger / OpenAPI configured and available in the development environment
- HTTPS and authentication pre-configured in the pipeline
Testing
- Unit test project with xUnit, Moq, and Coverlet
Technologies
| Package | Version |
|---|---|
| .NET | 10 |
| Entity Framework Core | 10 |
| MediatR | 14 |
| FluentValidation | — |
| AutoMapper | 16 |
| Dapper | — |
| Polly | — |
| Serilog | — |
| xUnit | 2.9 |
| Moq | 4.20 |
Getting Started
Prerequisites
- .NET SDK 10.0 or later
- SQL Server (local or remote)
1. Install the template
dotnet new install w3ti.OpenBaseNET.SQLServer.Template
2. Create a new project
mkdir MyApi
cd MyApi
dotnet new openbasenet-sql -n MyApi
3. Configure the connection string
Edit src/MyApi.Presentation.Api/appsettings.json:
{
"ConnectionStrings": {
"OpenBaseSQLServer": "Server=.;Database=MyApi;Trusted_Connection=True;TrustServerCertificate=True"
}
}
4. Run
dotnet run --project src/MyApi.Presentation.Api/MyApi.Presentation.Api.csproj
The API will be available with Swagger at https://localhost:{port}/swagger.
Contact and Feedback
Rodrigo S. Brito — rodrigo@w3ti.com.br
Feedback and contributions are always welcome.
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.3.5 | 149 | 6/12/2026 |
| 10.3.4 | 349 | 5/13/2026 |
| 10.3.3 | 183 | 5/12/2026 |
| 10.3.2 | 171 | 5/11/2026 |
| 10.3.1 | 204 | 5/10/2026 |
| 10.3.0 | 172 | 5/10/2026 |
| 10.2.4 | 194 | 5/3/2026 |
| 10.2.3 | 205 | 4/25/2026 |
| 10.2.2 | 198 | 4/24/2026 |
| 10.2.1 | 200 | 4/16/2026 |
| 10.2.0 | 186 | 4/16/2026 |
| 10.1.22 | 193 | 4/15/2026 |
| 10.1.21 | 206 | 4/8/2026 |
| 10.1.20 | 211 | 4/3/2026 |
| 10.1.19 | 215 | 3/18/2026 |
| 10.1.18 | 230 | 3/14/2026 |
| 10.1.16 | 220 | 3/10/2026 |
| 10.1.15 | 215 | 3/10/2026 |
| 10.1.14 | 226 | 3/4/2026 |
| 10.1.13 | 257 | 2/26/2026 |
- Atualização de pacotes nuget