<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur" -->

---
title: Build a .NET 10 Web API - Minimal APIs, EF Core & SQL Server
description: A step-by-step walkthrough builds a .NET 10 Web API using Minimal APIs, Entity Framework Core, and SQL Server, structured with Clean Architecture across...
canonical: https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Build a .NET 10 Web API - Minimal APIs, EF Core & SQL Server | daily.dev
og:description: A step-by-step walkthrough builds a .NET 10 Web API using Minimal APIs, Entity Framework Core, and SQL Server, structured with Clean Architecture across...
og:url: https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur
og:image: https://api.daily.dev/og/posts/bTgD67VUr.png
og:image:alt: Build a .NET 10 Web API - Minimal APIs, EF Core & SQL Server
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a .NET 10 Web API - Minimal APIs, EF Core & SQL Server

**[Round The Code](https://daily.dev/sources/roundthecode)** · 14 min read · 0 upvotes · 0 comments

## Summary

A step-by-step walkthrough builds a .NET 10 Web API using Minimal APIs, Entity Framework Core, and SQL Server, structured with Clean Architecture across Application and Infrastructure projects. It covers Centralised Package Management, re-adding Swagger (removed by default since .NET 9), setting up the DbContext and entity configurations, EF Core migrations, FluentValidation for DTO validation with a custom exception handler, and implementing full CRUD endpoints (create, get, update, delete) for a Product entity.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.roundthecode.com/dotnet-tutorials/build-dotnet-10-web-api-minimal-apis-ef-core-sql-server>

## Questions this post answers

### Why is Swagger UI missing by default in a new .NET 10 Web API project?

Swagger used to be installed and configured automatically when creating a new Web API project, but this was removed starting in .NET 9, so it must be added back manually. This involves installing the Swashbuckle.AspNetCore.SwaggerUI package and calling app.MapOpenApi() plus app.UseSwaggerUI() in Program.cs, pointing the endpoint to /openapi/v1.json.

_Developers re-adding Swagger to new .NET projects can find setup walkthroughs like this one on daily.dev._

### How do I set up Centralised Package Management in a .NET solution?

Run 'dotnet new packagesprops' in the solution folder to generate a Directory.Packages.props file, set ManagePackageVersionsCentrally to true, and move each package's version into a PackageVersion element there instead of the .csproj. Then remove the version attribute from each PackageReference in the .csproj files so versions are managed in one place across projects.

_Teams standardizing NuGet versions across projects can track setup guides like this on daily.dev._

### How do I return a 400 instead of a 500 when FluentValidation throws a ValidationException in ASP.NET Core?

Implement a custom IExceptionHandler class that checks if the caught exception is a ValidationException, groups the errors by property name, sets the response status code to 400, and writes a ValidationProblemDetails response. Register it with services.AddExceptionHandler<ValidationHandler>() and services.AddProblemDetails(), then call app.UseExceptionHandler() in Program.cs.

_Developers wiring up FluentValidation error handling in minimal APIs can compare approaches like this on daily.dev._

## Similar posts on daily.dev

- [Creating a Production-Ready CRUD Application in ASP.NET Core](https://daily.dev/posts/creating-a-production-ready-crud-application-in-asp-net-core-1mfpkrepl) · Telerik · 0 upvotes · 0 comments
- [Testing ASP.NET Core Web API: WebApplicationFactory and Integration Tests](https://daily.dev/posts/testing-asp-net-core-web-api-webapplicationfactory-and-integration-tests-8chotq6j5) · We Are .NET · 1 upvotes · 0 comments
- [Dapper in Depth with ASP.NET Core 10](https://daily.dev/posts/dapper-in-depth-with-asp-net-core-10-oad4bk2bw) · C\# Corner · 1 upvotes · 0 comments

---

Tags: [#.net](https://daily.dev/tags/.net), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Build a .NET 10 Web API - Minimal APIs, EF Core & SQL Server","url":"https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur"},"datePublished":"2026-10-04T13:06:00.408Z","dateModified":"2026-10-04T13:13:49.522Z","description":"A step-by-step walkthrough builds a .NET 10 Web API using Minimal APIs, Entity Framework Core, and SQL Server, structured with Clean Architecture across...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/559fb84f20771d53201b63f7d837510d?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/559fb84f20771d53201b63f7d837510d?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Round The Code","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Round The Code","logo":"https://media.daily.dev/image/upload/s--HmwWBSI1--/f_auto,q_auto/v1791119052/logos/roundthecode?_a=BAMAMicg0","url":"https://daily.dev/sources/roundthecode"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":".net,microsoft-sql-server","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Round The Code","item":"https://daily.dev/sources/roundthecode"},{"@type":"ListItem","position":3,"name":"Build a .NET 10 Web API - Minimal APIs, EF Core & SQL Server"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/build-a-net-10-web-api---minimal-apis-ef-core-sql-server-btgd67vur#faq","mainEntity":[{"@type":"Question","name":"Why is Swagger UI missing by default in a new .NET 10 Web API project?","acceptedAnswer":{"@type":"Answer","text":"Swagger used to be installed and configured automatically when creating a new Web API project, but this was removed starting in .NET 9, so it must be added back manually. This involves installing the Swashbuckle.AspNetCore.SwaggerUI package and calling app.MapOpenApi() plus app.UseSwaggerUI() in Program.cs, pointing the endpoint to /openapi/v1.json. Developers re-adding Swagger to new .NET projects can find setup walkthroughs like this one on daily.dev."}},{"@type":"Question","name":"How do I set up Centralised Package Management in a .NET solution?","acceptedAnswer":{"@type":"Answer","text":"Run 'dotnet new packagesprops' in the solution folder to generate a Directory.Packages.props file, set ManagePackageVersionsCentrally to true, and move each package's version into a PackageVersion element there instead of the .csproj. Then remove the version attribute from each PackageReference in the .csproj files so versions are managed in one place across projects. Teams standardizing NuGet versions across projects can track setup guides like this on daily.dev."}},{"@type":"Question","name":"How do I return a 400 instead of a 500 when FluentValidation throws a ValidationException in ASP.NET Core?","acceptedAnswer":{"@type":"Answer","text":"Implement a custom IExceptionHandler class that checks if the caught exception is a ValidationException, groups the errors by property name, sets the response status code to 400, and writes a ValidationProblemDetails response. Register it with services.AddExceptionHandler<ValidationHandler>() and services.AddProblemDetails(), then call app.UseExceptionHandler() in Program.cs. Developers wiring up FluentValidation error handling in minimal APIs can compare approaches like this on daily.dev."}}]}
```

