Join Reynald Adolphe for an in-depth discussion in this video Using the exercise files, part of Learning Entity Framework Core.
- [Instructor] If you have access to the exercise files you can follow along with the code examples that I'll be working on in this course. Within these files you'll find a folder for each chapter of the course. Within each chapter you'll find sub folders for each specific video. And within each of those folders, you'll see that there is a start and a finish state. If you want to follow along, open up the solution in the Start folder, and when you are done you can compare what you have with what I have in the Finish folder.
Now, a couple of things I want to mention regarding these exercise files. This is an updated video to reflect some changes that has occurred. Microsoft has made some changes to the solutions structure of DocNet files. As such, project.json files are not being used anymore when generating a DocNet Core project in Visual Studio. So, if you see a project.json file that's created in the solution in the video, whereas when you follow the steps it's not, that's completely fine because of the changes that has occurred by Microsoft.
Now with the newer version of Visual Studio, when you launch the project you're going to have to upgrade. For example, I'm here in chapter two, section six. I'm going to open up the last solution file there, in the finish state, and what you'll see is that I'll be prompted to upgrade the solution, which is fine. So I'll go ahead and click Okay. Now it didn't happen to me in this particular case, but sometimes you might get prompted with a migration report.
Don't worry about that. You can just go ahead, close out of that and let the solution continue to open up. The other thing that I want to mention is that certain states of this application assumes that a local database was already created. So if I try to run this application right now, I might try to build, and that seems okay, but when I try to Run I get this exception because it did not have access to the database.
It said it could not open the database. And the reason why is because the local database was not created. So the exercise file is fine itself. We need to update the database, and the way we do that is through the Package Manager Console. The way I just opened it up, by the way, is just by going to Tools, and you'll get Package Manager, and hitting Package Manager Console. And within here I can go ahead and type in Update-Database and hit Enter.
Now after doing this, looks like it updated it correctly, and it says that it's done. I should be able to execute this application. And there it goes. There's the output without any SQL database error. And now that we went through this step, if you try to run any other application in some other states, it should run fine without having any SQL database issue.
- Entity Framework (EF) overview
- Uses for EF
- Installing EF
- Creating entities
- Creating the DbContext
- Performing migrations
- Creating an MVC application
- Installing EF packages
- Reverse engineering the model
- Performing context and dependency injection
- Creating the controller and the view
- Using SqlServerTypeMapper
Skill Level Intermediate
Q: This course was updated on 06/23/2017. What changed?
A: The following topics were updated: using the exercise files; Mac install prerequisites; Entity Framework on Mac, part 1; and Entity Framework on Mac, part 2.