English 中文(简体)
实体框架——第一守则或可能的模式? [复制]
原标题:Entity framework - code first, or maybe model? [duplicate]
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
EF 4.1 Code-first vs Model/Database-first

i made some research, but answers did not satisfy me. I started my own asp.net mvc application with entity framework, to work with database. I started by making a db, than i create model from that database. Well i know thats called "model-first". I know the second way, of doing it from school (code first). My lecturer told me today, that model-first method is rly outdated. Well is that true? Or maybe: does code-first have any advantage? Whats the real difference, which one is better, in your opinion?

问题回答

具体来说,欧洲自由贸易联盟的代码首先指的是代码,模型首先指数据库。

这实际上取决于该项目。 如果将db作为申请的核心处理,或者你正在使用db特定特征,而不是首先采用的模式。

如果将域模型视为应用的核心,则将 d作为持久性储存的一种形式,而代之以法则是实用的。

作为一个附带说明:这一概念通常称为模式一(域/代码)和(b)第一(db schema)。 这与电子格式有些混淆,因为模型指的是db schema,而不是域模型和代码指的是代码。

第一行根本就没有过时。 事实上,对许多公司项目来说,这些项目为前进道路提供了便利。

如果你为从零开始而做一些事情的话,守则首先可能是一种更好的办法。

Entity Framework provides: 1)Database first, 2)Model first and 3) Code first. 1 & 2 Creates the edmx file Database first: Entity Data Model(edmx:StorageModels) is created from an existing database. Model first: Conceptual Data Model(edmx:ConceptualModels) is created with designer and mappings specified. Database will be generated from this. Code first: Create your .NET classes(no .edmx file). Database will be generated from this.

旧学校将使用ADO。 NET DataSet/DataTable.

Fastest data access is using DataReader and writing your own data access. No framework will be faster than using a DataReader to populate your own POCOs.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签