Join Richard Goforth for an in-depth discussion in this video Scaffolding an initial model and context, part of Accessing Existing Databases with Entity Framework Core.
- [Narrator] Entity Framework maps the database to code…by combining data models in a DbContext.…We're going to use the Entity Framework CLI,…command line interface,…to scaffold the models…and the context from the existing database.…To connect to the database, we need a connection string.…For SQL Server Express,…we can get the connection string…by opening up the SQL Server object explorer,…drop down SQL Server, MSSQLLocalDB, Databases,…right click on our database and select Properties.…
From within the properties window,…we can copy the connection string.…Now we'll open up a command line or terminal window.…Windows r, cmd, next we'll navigate to our project folder.…Start with .net ef, for Entity Framework,…dbcontext and scaffold.…Now, using quotes, we'll paste in our connection string.…The next argument is the type of database…that we're going to be using.…In our case this is SQL Server.…Finally, we'll use an output directory for our models.…
We're going to name this directory Models.…Now if we go back to view our project in Visual Studio,…
- Setting up your project
- Connecting to a legacy database
- Scaffolding an initial model and context
- Improving the model
- Updating properties and indexes
- Adding concurrency tokens and timestamps
- Creating complex relationships
- Working with non-Microsoft databases such as SQLite and PostgreSQL
Skill Level Intermediate
SQL Server 2014 Essential Trainingwith Martin Guidry3h 51m Intermediate
Microsoft SQL Server 2014: Backup and Recoverywith Martin Guidry1h 22m Intermediate
1. Get Started with EF Core: On Your Legacy Database
2. Improve the Model
3. Model Complex Relationships
4. Work with Non-Microsoft Databases
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.