

In the Terminal, type the following command: dotnet ef migrations add LimitStrings
#ICONSOLE APPLICATION EXAMPLES CODE#
Next, add a new file named Author.cs and add the following code to it: using If you don't place your context class in a namespace and you are working with EF Core versions prior to 2.1, you may come up against this bug - now fixed in 2.1 when adding your migration. Protected override void OnConfiguring(DbContextOptionsBuilder The model, particularly the DbContext class, is declared inside a namespace.

Public class EFCoreDemoContext : DbContext This results in a minimal console application:Īdd a new file named EFCoreDemoContext.cs and add the following code to it: using Microsoft.EntityFrameworkCore This should result in the initial help for the EF tools being displayed:įinally build and run the application with the single command: > dotnet run This may not have been added automatically: įinally, run the following command to restore the packages and then test to see that the ef commands are available to the project: > dotnet restore csproj file to include the following additional is added to the project.

