Solved

Entity Framework 4.0 and pluralization

Posted on 2011-03-10
3
744 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
crm development 2 39
Unable  to create new object 9 28
Getfiles in vb.net 28 25
XAML: Layout 8 9
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now