The much improved EDM Wizard Pluralization in VS2010

Previous "What's New in EF 4 Posts"

ef4

 

 

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".

efwizardd

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).

efwizarde

Now to check the EntitySet names. Here are screenshots of just a few to show you that the wizard handled those well, too.

efesa   efesb  efesc

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?

#1 Dan soltesz on 5.22.2009 at 9:29 AM

this is a great feature.I don't know how much time i spend just cleaning up the names.

#2 Stephan on 9.17.2009 at 2:38 PM

Where do I find the EDM Designer / Wizard in Visual Studio 2010?

Is a special download required?

#3 Julie on 9.17.2009 at 2:42 PM

Once you are in a project, you can add a new item - choose ADO.NET Entity Data Model. This will fire up the wizard. When you have a model in the project (an EDMX file) , the designer opens by default when you open the model.

No special download. It's part of VS2010.

hth

julie

Leave a Comment