Specifying singular table names

Entity Framework usually generates Tables with plural names. For example, a Student class would generate a table Students. This could be a little inconvenience for teams who insists on plural names. The solution is to override the ‘OnModelCreating’ Method to remove the plural features.

image

This would ensure plural names are used in every concerned Context. Now the question is, what if we need to give plural name only for selected table names.

image

This would ensure that the Standard Table is created with a plural name. Overriding OnModelCreating is very useful method to have when you need to provide customization of tables that is being generated by Entity Framework.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s