I am trying to add a few extra fields to the register page in the default asp.net mvc application that we get when we open visual studio. I followed this tutorial.
These are the steps that I followed after opening the default project that we get in Visual studio for asp.net MVC.
First I ran the project and clicked on Register button and registered a random user. I did this so that the default database would get created.
- Now that the database was generated, I went to the database and added extra columns like Gender, Birthday, FirstName, LastName and AboutUser and re-updated the database table called ASPNETUSERS.
- Now I went to RegisterViewModel and added these same properties as well.
- After that I went to ApplicationUser and added the same properties as well.
After that I changed the view for Register.cshtml to incorporate extra textboxes, textareas for the new fields that I created.
Now I went to the controller and added these properties in as well. Everything seems fine to me so far, except the fact that the database's definition changed from the beginning.
This is how the page looks after all these changes.
Now I ran the project and tried to register a person, but I keep getting this error.
I researched about this error, but the solutions suggest that I should try adding Database.SetInitializer<YourDbContext>(null); in the constructor of myDBContext. But the thing is, I don't have any context at all. So this solution doesn't seem to work for me.







ApplicationUseras you have, then run the migration steps. You might have to runenable-migrationsfirst. You'll want to read up on Code First.-IgnoreChangesjust tells the migrations to skip the schema check. In your next project doenable-migrationsfirst and you won't have that issue.