kalls
kalls

Reputation: 2855

Entity Framework Table Naming Convention

I am new to Entity Framework. I am currently doing a project in ASP.NET, Crystal Reports and LINQ to SQL.

I have the following tables on the database and I created my DBML from the database

  1. City
  2. City_Staff
  3. City_Program_Contact
  4. City_Official
  5. Comprehensive_Service

This didn't error out. I just realized the DBML creates Class(Objects) and I am wondering whether this is a correct naming convention for the tables.

It could be great if you can let me know about SQL Server table naming convention and also correct naming convention in Entity Framework.

Upvotes: 4

Views: 4016

Answers (2)

Arun Prasad E S
Arun Prasad E S

Reputation: 10115

I use

TblTeachers , TblStudents

I am thinking of putting it as

TeachersTbl , StudentsTbl

The Intellisense has other classes which looks like these table names, for filtering them out easily, I use Tbl in the naming.

Upvotes: 0

Wahid Bitar
Wahid Bitar

Reputation: 14084

First of all I'm not a big fan of using "_" in the naming. I use UpperCamelCase instead.

For Tables :

I advice you to use Plural in all Entities tables:

  • Cities
  • CityStaffs

And if the table is just representing many to many relation and has no other fields then I name it as two Singular parts :

  • CityUser

That will represent these classes after mapping in EF :

  • City
  • CityStaff

And in the City class you'll have Users property

Upvotes: 6

Related Questions