I'm using EF7 RC2 in my ASP.NET core RC2 application and I'm trying to generate my db from code (I'm using code first). I created my context, and setup my connection string, but when I enter "Add-Migration" in the NuGet console in VS2015, I get an error saying
The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program.
I did some digging, and I think that command is an RC1 thing. Is there an RC2 equivalent? Are there any tutorials out there for EF7 RC2? All I could find are for RC1 or early.
In a regular command prompt with the new dotnet
tooling installed from RC2, you should be able to do the following within your project's directory:
dotnet ef migrations add [name]
As a quick note, you may want to explore the new commands to see what's all in each item. Such as dotnet
vs. dotnet ef
(https://blogs.msdn.microsoft.com/dotnet/2016/05/16/announcing-net-core-rc2/)
You may need to ensure Powershell 5 is installed to get this to work within the Package Manager Console:
You also need to add this to your project.json file and "Microsoft.EntityFrameworkCore.Tools" : "1.0.0-preview1-final"
to your dependencies.
"tools": {
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
}
For Entity Core...go to package Manager within visual studio and then simply type: update-database
this should create the tables in the persistent store specified