3

I am trying to create a new Entity Data Model (database first) with entity framework 6 using the wizard provided in Visual Studio 2015 Community edition. All my table names are pluralized (ex. mn_Bills). I chose the "Pluralize or singularize generated object names" but this does not singularizes the object names (i.e. the generated class for table mn_Bills is mn_Bills in a mn_Bills.cs file).

I have modified the "Name" and "Entity Set Name" in the Model Browser which resolved only partly the problem. The classes generated are singular, which is good, but the foreign key associations for N to 1 associations are pluralized:

public partial class mn_Bill
{
    ...
    public virtual mn_Clearing mn_Clearings { get; set; }
}

Do you know if there is any workaround for this problem (besides changing the table names)?

Copil tembel
  • 399
  • 4
  • 22

2 Answers2

0

I met a similar problem with underscore table names and it seems that the PluralizationService doesn't support underscores.

The answer, it seems, is to override the default service with some of your own code.

I've not done this for a database first edmx solution, because I'm using an alternative code generation engine - but this may be possible to override in the code generation step.

See this answer here:

Entity Framework EDMX - Entity Pluralization Fix

https://blogs.msdn.microsoft.com/efdesign/2008/12/01/pluralization/

Kaine
  • 1,285
  • 2
  • 16
  • 30
-3

Just select "Pluralize or singularize" option in the EDMX wizard.

enter image description here

Anton Lyhin
  • 1,925
  • 2
  • 28
  • 34