“复数或单数生成的对象名称”是什么意思?环境?
设置新的实体数据模型时,可以选择
[x] 将生成的对象名称复数或单数化
我注意到这也是 LINQ 中的一个选项。另外,现在我正在研究 ADO.NET 实体框架,我注意到它还有“默认”来“复数或单数生成的对象名称”
设置“实体数据模型”时不检查/允许此选项的结果是什么'。
选择其中一种方式我会面临哪些优势/劣势/问题?
When setting up a new Entity data Model, there is an option to
[x] Pluralize or singularize generated object names
I have noticed this is an option in LINQ as well. Also, now that I am studying the ADO.NET entity framework, I noticed it also has 'DEFAULT' to 'pluralize or singularize generated object names'
What is the result of not checking/allowing this option when setting up the 'Entity Data Model'.
What Advantages/Disadvantages/issues will I face by making a selection one way or the other?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果勾选
复数或单数生成的对象名称
,则EF生成的类context.cs
中的集合将按照以下格式命名:如果不勾选,则为命名:
优点/缺点恕我直言:
我希望看到以“s”结尾的集合集命名,例如
Employee Table
的Employee class
的 dbset colleciton 名为员工
,所以我会检查该选项。但我想也许有人想将 dbset 视为一个表,因此他/她希望将其命名为与表名Employee
相同的名称。If you check
Pluralize or singularize generated object names
, the set in the classcontext.cs
genrated by EF will be named in the format:if not check, it'll be named:
Advantages/Disadvantages IMHO:
I would like to see collection set be named ending with 's', such as dbset colleciton of
Employee class
ofEmployee Table
namedEmployees
, so I'll check the option. But I guess maybe someone would like to treat the dbset as a table, so he/she would like to name it same as table nameEmployee
.完全没问题,只是您可能需要手动执行此操作。通常,您需要实体名称为单数,实体集名称为复数。
No problem at all, except that you'll probably want to do it manually. Usually, you want entity names singular and entity set names plural.