Use one of the methods below to create a web api project
Run the following command to create a web api project from a template from the command prompt
- Go to the project location using cd <path>
- CD C:\Users\david\Documents\\Projects\mot_service
- Then run following command
- dotnet new webapi -o theprojectname -f netcoreapp3.1
- cd theprojectname
- Then run following command that will open the project in Visual Studio Code
- code -r ../theprojectname
In visual studio code, Go to Terminal
- dotnet new webapi -o theprojectname -f netcoreapp3.1
- Open the project from the editor or run in the terminal :
- code -r ../theprojectname
dotnet add package Microsoft.EntityFrameworkCore.Sqlite
Create your DbContext class and Model classes
Use the following commands to create the database.
- To add migrations - dotnet ef migrations add InitialCreate
- To create database - dotnet ef database update
To see the sqllite file use SQL Lite Studio or sqlitebrowser
No comments:
Post a Comment