Previous "What's New in EF 4 Posts"
- Checking for EF to TSQL Query Compilation Changes in VS2010 Beta1 May 19
- EF4- What is and is not supported May 13
As promised, there have been a LOT of improvements to the EDM Designer in VS2010. THe first one I looked for was to see how the pluralization worked (using English table names).
I began with a sample database that provided a number of naming challenges, such as tables that were already pluralized and tables that need more than just adding an "s" to make them plural.
The first few pages of the EDM Wizard are unchanged, but the page where you select your db objects has one important new checkbox: "Pluralize or singularize generated object names".
Notice the table names which I have highlighted. Addresses is already plural and its pluralized format is "es", not just "s". Brewery doesn't just get an "s", but will need to be Breweries.FavoriteBreweries will need to get singularized down to FavoriteBrewery. OldAddress will need to become OldAddresses. And Person will need to be People. Here is a slice of the generated model where you can see not only that the entity names have been affected properly, but even the navigation properties (FavoriteBrewery.Brewery, Brewery.FavoriteBreweries, Person.Addresses).
Now to check the EntitySet names. Here are screenshots of just a few to show you that the wizard handled those well, too.
Another important test is to see what happens when you change an entity name in the properties windows. In VS2008, that would trigger an EntitySet rename to Name + "Set". This is mostly unexpected behavior. In VS2010, the Entity Set Name remains untouched.
Question: Now that the pluralization works so well, would you want it to automatically pluralize the Entity Set Name based on whatever you changed the Entity Name to? Or is leaving it alone the best common denominator here?




