Solved

Entity Framework 4.0 and pluralization

Posted on 2011-03-10
3
750 Views
Last Modified: 2012-06-27
I love both EF4 and Dynamic Data. I need to create a URL that will render with a Dynamic Data page, but find that pluralization is a problem. I have the actualk table name (e.g. attachment), but EF4 referes to that file as attachments.

Is there a map in EF4 that I can use and thereby create a url using attachments?

Thanks,
newbieweb
0
Comment
Question by:newbieweb
  • 2
3 Comments
 
LVL 41

Expert Comment

by:graye
ID: 35109298
I'm confused... the whole point of using entities is that your NOT using the database structure.  It was designed to provide a separation between the business logic of your app and the data access of your app.  So, it should not be suprising that the entity collections do not match the table names.  

The Dynamic Data template is designed to use entities... and not directly touch the database tables.

... unless I've complete missed the point?
0
 

Accepted Solution

by:
newbieweb earned 0 total points
ID: 35111078
No, you are right about that. But we need to configure the Dynamic Data website to group the tables by the user's role, and in some cases hide the table altogether. So we created a DB_tables table with a few extra properties than the table name. But when creating the URL for the Dynamic Data, I need the following code to transpose the original table name into the entity name:

using System.Globalization;

public string GetPluralization(string singular)
{
   var pluralizer = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en"));
   return pluralizer.Pluralize(singular);            
}
0
 

Author Closing Comment

by:newbieweb
ID: 35145544
So I am satisfied this works fine.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question