I'm in OSX and I'm creating a new ASP.NET Core Web API. I've followed this tutorial: https://docs.efproject.net/en/latest/platforms/netcore/new-db-sqlite.html
That's cool and all but what about Sql Server? Now I know SQL Server won't yet run on OSX (https://www.microsoft.com/en-us/cloud-platform/sql-server-on-linux).
The only way I can see to make this work is if I create a cloud remote SQL server (on Azure or similar), then connect with it from my ASP.NET core application. I tried following this, but it assumes VS2015 https://docs.efproject.net/en/latest/platforms/aspnetcore/existing-db.html. We don't have the package manager console in VSCode and I don't know if there is an equivalent to Scaffold-DbContext.
So how do I make a connection to SQLServer and how do I do things like EF migrations to update that database.
All the packages download can be done without the package installer, by using project.json and dotnet restore
(if VSCode doesn't do it when project.json is saved).
With the tools installed, you can create migrations with dotnet ef migrations add <migration name>
and dotnet ef database update
to apply the migrations to the db schema.
Class libraries (where DbContext and models are defined in class library) are not supported yet. There is a workaround in the Entity Framework Core docs though.
For scaffolding the usage is dotnet ef dbcontext scaffold [arguments] [options]
. See the Scaffolding docs for details.