Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 932
user287745 Avatar asked Feb 08 '11 15:02

user287745


People also ask

What is the meaning of pluralize and Singularize in Entity Framework?

Pluralize or singularize generated object names checkbox singularizes an entityset name, if the table name in the database is plural. For example, if the SchoolDB database contains the Students table name, then entity set would be singular Student .

What is pluralize and Singularize in the Entity Framework dialog box?

What is pluralize and singularize in the Entity Framework dialog box? “Pluralize” and “Singularize” give meaningful naming conventions to objects. In simple words it says do you want to represent your objects with the below naming convention: One Customer record means “Customer” (singular).


2 Answers

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.

like image 54
yu yang Jian Avatar answered Oct 27 '22 00:10

yu yang Jian


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.

like image 41
Craig Stuntz Avatar answered Oct 27 '22 01:10

Craig Stuntz