sha*_*haz 7 entity-framework ef-database-first asp.net-mvc-4
我已经开始使用数据库第一种方法(使用现有数据库)开始一个非常简单的ASP.Net MVC4应用程序.我.edmx使用ADO.Net实体数据模型模板生成了.该进程已xxxxxxx.Designer.cs在xxxxxxx.edmx选项下创建了一个文件.但是,.cs文件为空,并显示以下消息.
// Default code generation is disabled for model 'C:\Visual Studio 2010\Projects\xxx\DProject\Models\BIReportDataModel.edmx'.
// To enable default code generation, change the value of the 'Code Generation Strategy' designer
// property to an alternate value. This property is available in the Properties Window when the model is
// open in the designer.
Run Code Online (Sandbox Code Playgroud)
在消息之后,我更改了在xxxxxxx.Designer.cs文件中生成代码的属性.
题:
数据库第一种方法到底是什么过程?
我见过很多帖子/博客/教程,所有这些似乎都很混乱,主要是针对CodeFirst方法.
代码首先在技术上是第一和没有一个数据库(它是灵活的),您只需创建POCO的(普通的老C#对象),这些课程将映射出你的数据库表模式的结构,你想怎么的,在数据库中是否存在或不是一个数据库.如果您不知道自己在做什么,那么您可能不想这样做.
EDMX,以前是设计师会填充,但在VS 2012和更大的tt文件是默认.您应该使用nuget的tt编辑器来真正从中获取更多.
或者我建议你做以下事情
1. Open the EDMX file - double click
2. Right Click in the EDMX diagram and click on Properties
3. In the properties window change the "Code Generation Strategy" from None to Default
4. Delte the tt files as you don't want both entities / contexts in project.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8742 次 |
| 最近记录: |