Building a web service that supports OData
There is no dotnet
new
project template for ASP.NET Core OData, but it uses controller classes, so we will use the ASP.NET Core Web API project template and then add package references to add the OData capabilities:
- Use your preferred code editor to add a new project, as defined in the following list:
- Project template: ASP.NET Core Web API /
webapi --use-controllers
- Solution file and folder:
MatureWeb
- Project file and folder:
Northwind.OData
- Project template: ASP.NET Core Web API /
If you are using Visual Studio, then confirm the following defaults have been chosen:
- Framework: .NET 9.0 (Standard Term Support)
- Authentication type: None
- Configure for HTTPS: Selected
- Enable container support: Cleared
- Enable OpenAPI support: Selected
- Do not use top-level statements: Cleared
- Use controllers: Selected
Make sure to select the Use controllers check box or your code will look very different because it will use Minimal APIs instead of controllers!
- If you are using VS Code or Rider, then...