8.10. Pluralization

Pluralization is a new feature in EF4 that generates more readable entity names. In EF1, if you had a table called Film, then your entities would be called Film, and entity sets of Film would also be called Film, which made querying not as readable as it could have been. Thus, many developers would manually rename entity sets of Film to be called Films, which could be pretty boring.

In EF4, if you select to use the pluralization option when creating the model, then Film's entity set will be automatically named Films.

Note that the new pluralization feature doesn't just stick an -s on the end of the table name. It is cleverer than that; for example, it knows when to append or remove -s, or when to modify the ending of a word to -ies (e.g., Category becomes Categories). Pluralization currently only works with US English, although there is an option to override this and provide your own pluralization provider.

The pluralization service is contained in System.Data.Entity.Design.dll (which is a shame, as this would be useful elsewhere) and has a static method called CreateService(). For more information, please see www.danrigsby.com/blog/index.php/2009/05/19/entity-framework-40-pluralization.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.84.157