Solved

Entity Framework 4.0 and pluralization

Posted on 2011-03-10
3
752 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled

740 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