简体   繁体   English

在实体框架的背景下,多个命名“问题”是什么?

[英]What is the plurality naming “problem” in context of Entity Framework?

在实体框架的背景下谈论多个命名“问题”时,人们的意思是什么?

It revolves around the fact that database objects named in certain ways will lead to either incorrect pluralization or singularization. 它围绕这样一个事实,即以某种方式命名的数据库对象将导致不正确的多元化或单一化。 A good example of this is illustrated by this Microsoft Connect issue . Microsoft Connect问题说明了这方面的一个很好的例子。

In this example, database objects end in "Status" are incorrectly singularized as "Statu", instead of being treated as a singularization that would be pluralized as "Statuses". 在此示例中,以“状态”结尾的数据库对象被错误地单独化为“Statu”,而不是被视为将被复数为“状态”的单一化。

It is annoying, but I wouldn't consider it to be widespread enough to deter a person from using EF. 这很烦人,但我不认为它足以引起人们使用EF。

From http://www.cnblogs.com/zjz008/archive/2010/06/03/1750442.html (re: Entity Framework 4.0 Features)... 来自http://www.cnblogs.com/zjz008/archive/2010/06/03/1750442.html(re:Entity Framework 4.0功能)......

Plurality Naming 多元命名

One of the big complaints in the first version of the Entity Framework was how naming conventions were applied to EDM objects such as entities and navigation properties when using the model wizards. 实体框架第一版中的一个主要问题是,在使用模型向导时,如何将命名约定应用于EDM对象(如实体和导航属性)。

The first version of the Entity Framework gave the Entity Name and the Entity Set Name the same name. 实体框架的第一个版本为实体名称和实体集名称赋予了相同的名称。 There was no attempt to singularize or pluralize names when generating a model from a database. 在从数据库生成模型时,没有尝试单独化或复数化名称。 The problem is that this caused some confusion when referencing the database table or EntityType in code. 问题是,在引用代码中的数据库表或EntityType时,这会引起一些混淆。 For example, if your database has a table called Employees, then you will also get an EntityType called Employees as well. 例如,如果您的数据库有一个名为Employees的表,那么您还将获得一个名为Employees的EntityType。 This causes confusion about whether you are referencing the table or the EntityType, such as in the code fragment below. 这会引起关于您是引用表还是EntityType的混淆,例如在下面的代码片段中。

Customers customer = new Customers();

Luckily, this issue has been addressed. 幸运的是,这个问题已得到解决。 The model wizards, both the Entity Data Model and Update Model Wizards, now provide the option of using singular or plural forms of names for entities, entity sets, and navigation properties. 模型向导(实体数据模型和更新模型向导)现在提供了对实体,实体集和导航属性使用单数或复数形式的名称的选项。

The goal of this change was to make the application code much easier to read and avoid a lot of the confusion between object names. 此更改的目标是使应用程序代码更易于阅读,并避免对象名称之间的大量混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM