你的位置:首页 > 软件开发 > ASP.net > Part 3 using entity framework

Part 3 using entity framework

发布时间:2015-10-05 21:00:03
Step1: Install entity framework using nuget package manager.Step2: Add a class file to the Models folder.(class name must equal connection s ...

Step1: Install entity framework using nuget package manager.

Step2: Add a class file to the Models folder.(class name must equal connection string name and inherit DBContext,DBContext is in the namespace of System.Data.Entity)

Step3: Add a connection string, to the web.config file, in the root directory.

Step4: Map model class to the database table using "Table" atttibute.

Step5: Make the required changes to action method in controller.

Step6: Paste the following code in Application_Start() function in Global.asax file. Existing databases do not need, database initializer so it can be turned off.

Database.SetInitializer<{class name}>(null)l

原标题:Part 3 using entity framework

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录