A basic Asp.NET Core v10 OpenAPI template. It uses an embedded SQLite database for data persistence.
First, you need to create the database. Follow the instructions in the Entity Framework Core setup section below to install the necessary tools and packages.
Then, run the database migrations to create the SQLite database.
cd AspNetCoreAPI
dotnet ef database update
This creates AspNetCoreAPI/aspnetcoreapi.db. If you need the test database too, copy it to the test project:
cp aspnetcoreapi.db ../AspNetCoreAPI.Test/aspnetcoreapi.db
To build the application run
dotnet build
To run the application run
cd AspNetCoreAPI
dotnet run
Build
docker build -t aspnetcoreapi:1.0 .
Run
docker run -p 3000:3000 aspnetcoreapi:1.0
Read all about Entity Framework core here: https://docs.microsoft.com/it-it/ef/core/get-started/overview/first-app?tabs=netcore-cli
dotnet tool install --global dotnet-ef
dotnet add package Microsoft.EntityFrameworkCore.Design
If you need to update the Entity Framework core:
dotnet tool update --global dotnet-ef
dotnet test
Please note that the tests rely on a different database which contains only test data. The database for tests should be found in the AspNetCoreApi.Test project directory.
