DotNet Core and EF: Database First

In a LocalDB (SQLServer), I created 2 tables, City and Customer, with FKs from Customer to City. I populated them, and you can get the backup of those here.

From there, I wanted to scaffold out the POCOs, something like this:

That was achieved by this set of PowerShell commands, and some massaging of the content of the project.json (mostly to add SQLServer Tools to the default Web option, which by default right now references SqlLite):

cd C:\sandbox\dotnet
dotnet new -t Web
dotnet restore
dotnet ef
where.exe dotnet
dotnet --info
dotnet ef dbcontext scaffold "Server=(localdb)\MSSQLLocalDB;Database=MyDB;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o \temp

adsf

poco04

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s