I am new in .net core. I am adding migration in .net core Liabrary project in web API core 1.1. using below code.
Add-Migration example1
I am new in .net core. I am adding migration in .net core Liabrary project in web API core 1.1. using below code.
Add-Migration example1
If you are using VS Code or other editor:
In dotnet command cli type:
dotnet ef migrations add InitialCreate
obs:InitialCreate is the name of migration, you can give any name.
If you are using Visual Studio:
Create your database
Once you have a model, you can use migrations to create a database.
Open the PMC:
Tools –> NuGet Package Manager –> Package Manager Console
Run Add-Migration InitialCreate to scaffold a migration to create the initial set of tables for your model.
If you receive an error starting The term 'add-migration' is not recognized as the name of a cmdlet, close and reopen Visual Studio.
Run Update-Database to apply the new migration to the database. This command creates the database before applying migrations.
Source: https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db