What is the meaning of the “Pluralize or singularize generated object names” setting?

假装没事ソ 提交于 2019-12-09 14:20:21

问题


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?


回答1:


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.




回答2:


If you check Pluralize or singularize generated object names, the set in the class context.cs genrated by EF will be named in the format:

public virtual DbSet<SomeTableName> SomeTableNames { get; set; }

if not check, it'll be named:

public virtual DbSet<SomeTableName> SomeTableName { get; set; }

Advantages/Disadvantages IMHO:

I would like to see collection set be named ending with 's', such as dbset colleciton of Employee class of Employee Table named Employees, 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 name Employee.



来源:https://stackoverflow.com/questions/4935273/what-is-the-meaning-of-the-pluralize-or-singularize-generated-object-names-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!