Entity Framework 4: Any way to know the plural form of an Entity Type?
While working on a project I came across the need to identify what the entity set name is so I can use that to add an updated entity to the set. In order to identify the plural I came up with two options:
- Use the Pluralization service to figure out the entity set name: The problem with this is that you assume the plural is always the entity set name which is not a guarantee.
- Use the following command: YourEntityObject.EntityKey.EntitySetName
I ended up using the second option as that will always return the Entity set name but it is good to know how to “calculate” the entity set if you need to.