Reputation: 24592
CREATE TABLE [dbo].[ContentStatus](
[ContentStatusId] [int] NOT NULL,
[Status] [nvarchar](50) NOT NULL )
Creates:
public partial class ContentStatu
{
public ContentStatu()
{
this.Contents = new List<Content>();
}
public int ContentStatusId { get; set; }
public string Status { get; set; }
}
Upvotes: 3
Views: 2481
Reputation: 20421
Figured that I would put in an updated answer instead of a comment.
How can I stop EF Reverse Engineer changing plural to singular with Table names?
Well as the other person suggest. Use the Reverse POCO generator
Line 61 ( August 2016)
Comment out this line:
Inflector.PluralizationService = new EnglishPluralizationService();
Uncomment this line:
Inflector.PluralizationService = null;
Now instead of it taking a View named vwStatus and it deciding to change to vwStatu it will do a 1:1
However, If you want that complete control per table , view etc... OP answer will work for you.
Upvotes: 4
Reputation: 141
I was unable to solve your same issue of tt singularizing words ending in 's' as well while using VS Power Tools Beta 4 despite the fix for entityframework.codeplex.com/workitem/446 being posted and I did confirm I was on the correct version of EF - 6.1.1.
My solution was to use EntityFramework Reverse POCO Code First Generator and it is an AWESOME tool!! I highly recommend based off being super flexible and easy to use if you are able to start over with a new tt. Source Code Here
Watch Simon Hughes video for an in-depth (30 min) overview for getting started. My quick solution to not removing the trailing 's' was to:
// Pluralization ********************************************************************************************************************** // To turn off pluralization, use: // Inflector.PluralizationService = null; // Default pluralization, use: // Inflector.PluralizationService = new EnglishPluralizationService(); // For Spanish pluralization: // 1. Intall the "EF6.Contrib" Nuget Package. // 2. Add the following to the top of this file and adjust path, and remove the space between the angle bracket and # at the beginning and end. // < #@ assembly name="your full path to \EntityFramework.Contrib.dll" # > // 3. Change the line below to: Inflector.PluralizationService = new SpanishPluralizationService(); Inflector.PluralizationService = new EnglishPluralizationService(new CustomPluralizationEntry[] { new CustomPluralizationEntry("CustomerStatus","CustomerStatus"), new CustomPluralizationEntry("EmployeeStatus","EmployeeStatus"), });
Upvotes: 6