I am learning Basics of ASP.NET MVC. And I created a model view controller for a page. In my project I have instructor table and courses table. Once I ran the project and everything seemed to be working fine. But then I wanted to edit the model; like adding one more field in the instructor table present in courses.cs file. As soon as I did it one exception started coming stating about some context change and migration issue.
Error Message:
the context has changed since the database was created. Consider using Code First Migrations to update the database
I found that I need to add Database.SetInitializer(null); in global.asax file. Even after making that change I am still stuck with the same error. My question is since I am adding a field in courses.cs file by writing public string address_ { get; set; } . Do I need to manually add corresponding code in the view also. During initial solution views got created automatically with table columns (original) in it. But since I have added one extra column in the instructor table in courses.cs file. Do I need to manually add that particular field in the corresponding view in "indexcs.html" file? If no, then why am I still getting error. If yes, then do I have to manually open all the view related to courses.cs and start making changes manually. Because in courses view I have many .cshtml files. Do I need add at all the places respective changes related to me adding one extra field i.e, public string address_ { get; set; }. Is there any automatic way to do it. Like the way visual studio did it in the first time I made the controller.