I am doing an online course on MVC.Net that as a very superficial component of the Entity Framework.
So far this project consists of 2 classes (Movies and Customers), and associated Views and Controllers.
I am stuck because I am unable to replicate the Entity Framework component of the project.
Here are the steps, what I expected (based on the result on the course) and what I got:
1 - Create migration project
Steps: Nuget Package Manager > Type "enable-migrations"
Expected result: Success message. A folder "Migrations" created in the solution.
Actual result: Error. "enable-migrations is not recognized as the name of a cmdlet."
After investigating, I noticed that I didn't have the Entity Framework installed, so I installed it using NuGet. After that, the above command worked.
2 - Add migration
Steps: on the console, write "add-migration InitialModel"
Expected result: Sql commands are added to the "Migrations" folder. "IdentityModels" class added to the "Models" folder with some authentication methods.
Actual result: Error "No context type was found in the assembly". Basically nothing happened after that.
I found an article explaining that there has to be a class in the project that inherits from DbContext. So I did just that. Created an empty class that inherits from "DbContext". The command above now works, but the IdentityModels class was not created, no scrips were added, no authentication methods were created.
What am I missing? Why did I have to create this class inheriting from "DbContext" when the course video didn't have to do that? And finally why aren't these authentication classes and methods being automatically created the same way I saw on the course?
I am asking these questions because I really hope this issue will help me understand the Entity Framework a bit better.