In this article I will describe how to set the Web configuration file in ASP.Net MVC 3 using Entity Framework with object class mapping.

In your ASP.Net MVC 3 applications supposes you are using object class mapping using Entity Framework.

That means you write your classes using relationships and the classes will be converted to a table in the database. For that you have to set your Web .config file connection string setting. Because the connection string results in mapping a class to a table in the database and the data from the table will also come from the database.

Step 1:

First go to the Web config page for the main project like Figure 1:



Step 2:

Then comment the existing connection string code. (The existing code will not work for creating the tables from the mapping classes (POCO) classes).

After that paste the code shown below like figure 2:



So in this article we have learned how to change the connection string in the web.config file for ASP.Net MVC 3 using Entity Framework.