Why does EF 5.x use plural name for table?

后端 未结 2 999
日久生厌
日久生厌 2020-12-09 21:03

I\'ve had some experiences in ORM framework such as Hibernate, even Entity Framework 3.0.

By default, those frameworks use singular name for table. For example, clas

相关标签:
2条回答
  • 2020-12-09 21:40

    That convention is defined in the PluralizingTableNameConvention convention defined by default in the DbModelBuilder.Conventions

    If you want to exclude it from all tables, you can use the code from this question.

    Why this is done the way it is, I do not know, but I must say that I am, personally, in the camp that thinks that table names should be pluralized :)

    Of the example databases provided with an SQL Server instance, Northwind has plurals, and AdventureWorks uses a singular form, so at best, there is no established standard. I've had quite a few discussion for or against each one, but one thing that everybody can agree on is that when once pick a naming strategy, you should stick with it.

    0 讨论(0)
  • 2020-12-09 21:48

    When you generate your model with entity framework, uncheck "Pluralize or singularize generated object names"

    0 讨论(0)
提交回复
热议问题