Code First Migration Questions

I have some questions regarding “The Complete ASP.NET MVC5 Course”. I subscribed to your course. I am a beginner ASP.NET

May I please be guided on the following:
a. I tried “enable-migrations” but it showed an error “No context type was found in the assembly.” May I request an explanation of this error and how to resolve it.
b. In the video, under Models folder, there already exist IdentityModels.cs without further explaining how it was created. Is this automatically created when doing “enable-migrations”. If not, can fellow members help and direct me on how to create the model.
c. In your video, under App_Data, a database is automatically created using azure. Can fellow members provide more explanation if this was created automatically using “enable-migrations” and how ? if not, how was it created ?

When the course was created the template had “Individual User Accounts” as the default authentication type. Choosing that scaffolds all the classes needed for Microsoft Identity including a DbContext. Recent versions of the template default to “None” as the authentication type. Likely you didn’t change the current default.

Thank you very much. Will try it.


A. It is related to Entity Framework and the important bit is a class deriving DbContext. Identity is not mandatory for that step.

B. There is no Azure in the course (at least when I took it). However you have the possibility to use local database. In such case it will be created in the special folder App_Data. I used to create them manually because without it I had exceptions upon start but I found out there is actually a simple way in VS.

What happens is the default connection string uses local DB and the App_Data special folder is preferred. Now you can find this DB in your Windows profile folder instead. As App_Data and alike do not exist anymore in ASP .NET Core, this is where you’d find the MDF files.

Connection strings doc @MSDN