Description: 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.Content: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: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:<add name="CabDBContext" connectionString="data source=.;Database=Cabdb;Trusted_Connection=true;" providerName="System.Data.SqlClient" />Figure 2:I have attached a simple sample ASP.Net MVC3 application here so you can refer to that.Conclusion: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.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: