Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 1.42 KB

README.md

File metadata and controls

42 lines (25 loc) · 1.42 KB

ASP.NET Core v9 OpenAPI Template

Codacy Badge License: MIT

A basic Asp.NET Core v9 OpenAPI template. It uses an embedded SQLite database for data persistence.

Build Docker image

Build

docker build -t aspnetcoreapi:1.0 .

Run

docker run -p 3000:3000 aspnetcoreapi:1.0

Entity Framework Core setup

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

DB Migrations

cd AspNetCoreAPI
dotnet ef migrations add InitialCreate
dotnet ef database update

Unit Tests

dotnet test

Please note that the tests rely on a different database which contains only test data. The database is for tests is found in the AspNetCoreApi.Test project directory. To re-create the test database, simply re-run DB migrations and copy DB file ('aspnetcoreapi.db') to the test project directory.