01 Nov 2023

Lab 9 - Entity Framework Database

Expanding our knowledge to include entity frameworks!

For Lab 9, we were assigned to follow the Razor Pages with Entity Framework Core tutorial and to make our own page of a made up University. I named mine “Walter University” after the dog, Walter:

The easiest parts of this tutorial were the commands we were told to enter into the command line–these all worked for me first try, so I didn’t have to spend much time debugging that aspect. Also, copy and pasting the code was easy, too, but I had to change the name from “ContosoUniversity” to “WalterUniversity” pretty often. I realized later that you could do so globally through VSCode, which helped me tremendously throughout the project.

Below is an image of, by far, the most confusing part of the tutorial:

I got this error while attempting to modify the “Departments” tab of the website. I still don’t really know exactly what it means, but I remember from the last lab that when you don’t really know what’s going wrong, dropping and then creating the database again usually fixes it, and that it did! I got other errors along the way, too, but those were particularly less infuriating, as I didn’t spend 40 minutes trying to figure out where in the code I was messing up like I did with this one.

Working with multiple tabs was more difficult because you had to ensure that for every tab, each piece of the database was correctly updated. For each piece of the database to be correctly updated both the .cshtml and .cshtml.cs files, which got really tricky once I created pages for the Departments, Courses, Instructors, and Students.

I feel so much more prepared to create the database for our Final Project client. Our database will be dealing with a lot of the same kind of things, and now that we know how to create separate tabs with different information all linked together, I think initializing the Final Project is going to be much, much easier. I’m definitely stressing about it less, at least!

This was a fun lab! I can’t wait for the next one so I can learn how to further complicate databases to be more prepared and educated for the Final Project.