In this practice exercise, you will be guided through the development of the Mov
In this practice exercise, you will be guided through the development of the Movie List app that is presented in Chapter 4 of your textbook. You will generate a database from entity classes and use Entity Framework to create your SQL Server Database. Upon completing this exercise, you should be able develop apps that use multiple pages to work with a database. Follow along with the instruction sheet and Panopto videos provided for the Movie List Part A Practice Tutorial. The videos will guide you step-by-step through developing multiple pages, creating a database, and using LINQ to query data in the database. Files needed:
Practice 4-1 Part A (instruction sheet only)
Practice Tutorial 4-1A MovieListPartA.html (links to instruction sheet and videos with zip file)
Starting Web Application Files
You may create a new application or download and extract the following web application files to your computer before you begin Practice 4-1a.
Ch04MovieList_Start.zip
Written Instructions
Click on the following link to access the written instruction sheet for Practice 4-1a; follow along with these instructions as you complete the Series of Videos. You may want to print these instructions for easy reference.
Practice 4-1 Part A Move List Instructions
Video Instructions for Completing Practice 4-1A Movie List Application
01 Practice 4-1A Creating a data-driven web application, an overview of the Movie List app (4min 42sec)
02 Practice 4-1A Install EF Core SqlServer and EF Core Tools NuGet Packages (10min 11sec)
03 Practice 4-1A Create the Genre model class (2min 23sec) 04 Practice 4-1A Create the Movie model class (15min 34sec)
05 Practice 4-1A Create the MovieContext (DbContext) class (6min 7 sec)
06 Practice 4-1A Seed initial data for the Genre and Movie tables (10min 4sec)
07 Practice 4-1A Add a connection string (7min 21sec)
*Note for video 07 Practice 4-1A Add a connection string: It is very important that the connection string is correct. Double-check that you have the following specified for your connection string in the appsettings.json file:
…
“AllowedHosts”: “*”,
“ConnectionStrings”: {
“MovieContext”: “Server=(localdb)\mssqllocaldb;Database=Movies;Trusted_Connection=True;MultipleActiveResultSets=true;”
}08 Practice 4-1A Enable dependency injection (6min 35sec)
09 Practice 4-1A Create the Movies database (4min 58sec) 10 Practice 4-1A Run database migrations in Program.cs (7min 26sec)
11 Practice 4-1A Select data using LINQ with EF Core and include logging setting in appsettings.json (11min 20sec) *Note for video 11 Practice 4-1A: Add the following line of code “Microsoft.EntityFrameworkCore.Database.Command”: “Debug” after the “Microsoft.AspNetCore”: “Warning” line of code in the appsettings.json file instead of after the “Microsoft.Hosting.Lifetime”: “information” line of code as indicated in the video. See the code below for reference:
{
“Logging”: {
“LogLevel”: {
“Default”: “Information”,
“Microsoft.AspNetCore”: “Warning”,
“Microsoft.EntityFrameworkCore.Database.Command”: “Debug”
}
},12 Practice 4-1A Modify Home Controller to Select a list of movies from the database (7min 20sec)
13 Practice 4-1A Modify Index view to display movies, modify controller to include genre, and modify _ViewImports (19min 55 sec) 14 Practice 4-1A Work with additional Linq queries (5min 55sec)