Join Richard Goforth for an in-depth discussion in this video Connecting to the database, part of Accessing Existing Databases with Entity Framework Core.
- [Instructor] Now, we're going to restore the test database. H-Plus Sports is a fictional sporting goods company that we're going to use for the course. You can use the database backup file or the SQL script provided in the exercise files. We're going to use a SQL script to restore the database. Let's create an empty database by navigating to View, SQL Server Object Explorer. Right click on Databases, Add New Database. We'll name the new database HPlusSports. With the database created, we can run the provided script from the exercise files.
Navigate to the Exercise Files folder and open the SQL script. We'll now click this icon to connect to a database. We'll connect to our new database under Local, and MSSQLLocalDB. We can now run the script. Once the script is completed, we'll go back to SQL Server Object Explorer and drop down the Database, drop down Tables, right click on a table, and select View Data. We can see that our database has been populated with the test data. We're now ready to scaffold the database in Entity Framework Core.
- 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