Skip to content

Sample ASP.NET Core MVC application generated using dotnet CLI. EF Core tools were used to scaffold an existing AdventureWorks2019 database.

Notifications You must be signed in to change notification settings

kaevans/AdventureWorks

Repository files navigation

AdventureWorks 2019 ASP.NET Core MVC

This application uses Entity Framework Core to scaffold an existing AdventureWorks 2019 database.

EF Core scaffolding

Use the .NET Core CLI to scaffold the existing database, placing the generated models in the Models folder:

dotnet user-secrets init
dotnet user-secrets set ConnectionStrings:AdventureWorks2019 "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=AdventureWorks2019"
dotnet ef dbcontext scaffold Name=ConnectionStrings:AdventureWorks2019 Microsoft.EntityFrameworkCore.SqlServer -o Models

Once the DbContext is created, you can now generate pages using aspnet-codegenerator tooling, placing the generated Controllers in the Controllers folder:

dotnet aspnet-codegenerator controller -name ProductsController -m Products -dc AdventureWorks2019Context --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries

About

Sample ASP.NET Core MVC application generated using dotnet CLI. EF Core tools were used to scaffold an existing AdventureWorks2019 database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages