user9969
user9969

Reputation: 16060

Entity framework and tables with plural names .Is this a problem?

I am working on a database and all the tables have plural names. What is the best practice when using Entity framework 4.

Also I think in Sql server it is not best practice to name a table "Customers" but should be named "Customer"

In a nutshell are they problems when using plural table's names? If want to have them changed.I need a good explanations.

Any suggestions

Thanks a lot

Upvotes: 1

Views: 1670

Answers (4)

Kevbo
Kevbo

Reputation: 943

I would not recommend using singular names. My rule is to always pluralize table names when there are child tables. The reason for this is to avoid any confusion with the navigation properties on those child tables. As I mentioned in a comment earlier even if language problems arise its still best to keep all tables plural. A table containing Sheep should be called Sheeps regardless if it make sense in language terms.

Upvotes: 0

RetroCoder
RetroCoder

Reputation: 2685

I would suggest you fight the current framework b/c its only at version 1.0 as far as using pluralization forms correctly. There are forces at work to enhance the capability of plural and singular forms so that views are created depending on whether an entity is singular or plural. Obviously a plural form will give you a list or set of something whereas a singular entity is just that entity by itself. This elementary fact can lead one to deduce that the typography might change depending on which form you choose singular or plural.

The current version of the entity framework assumes that you won't combine all entity elements onto a single form and submit them all together at the same time. Instead they will use a more restful approach for each entity so that it creates each entity instance separately and rarely in parallel.

Upvotes: 0

indiPy
indiPy

Reputation: 8072

Entity framework and tables with plural names .Is this a problem?

Not at all, its just a feature. you can still do things in traditional way. I would prefer doing Plural way as it gives association and relations readable and less complex.

Upvotes: 1

jimjim
jimjim

Reputation: 2503

For the sake of sanity just use the singular form for everything, that way you know that your customer is kept in the customer table. Separate the human language aspects from programming. The pluralization idea is stupid when it comes to programming, for example lets say you have to work with Person, Fungus, Goose and what ever else that has an obscure pluralization rule. Everybody knows that programmers can't spell and also why do rules of natural language have to encroach on programming? then instead of having things like :

List people; List fungi; Goose[] geese;

we get to have List listOfPerson; List listOfFungus; Goose[] arrayOfGoose;

Natural language and programming language are two separate entities and enforcing the laws of first one onto the programming does not bring any benefits. Where as using some conventions that are logical and make sense to a programmer (and not to an English teacher) are far more beneficial in programming sense.

But then again these are some suggestions regarding naming conventions and I am not trying to start a naming convention war. Only use this method if it makes sense to you.

There are no technical problems if you use Customers, only that you have to keep swapping between them depending on context in your mind. So why complicate things by using pluralization/singularization?

Upvotes: 1

Related Questions