Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example "Custom renaming with epft.renaming.json" in documentation doesn't work as described. #364

Closed
marcoomeli opened this issue Apr 8, 2020 · 7 comments

Comments

@marcoomeli
Copy link

Hi there

In your documentation in the section "Custom renaming with epft.renaming.json", you write following:

The following efpt.renaming.json sample file will generate these names in the model:
public virtual DbSet< CourseOffering> CourseOfferings { get; set; }

But if i use your efpt.renaming.json sample file i get this

Result i get:
public virtual DbSet< CourseOfferings> CourseOfferings { get; set; }
Class and Filename: CourseOfferings and CourseOfferings.cs

Result i would like to get:
public virtual DbSet< CourseOffering> CourseOfferings { get; set; }
Class and Filename: CourseOffering and CourseOffering.cs

In my case i dont use the function 'Pluralize or singularize generated object names (English)' because we dont use english properties.

Questions

  1. Is there a way to rename the DbSet property name to get de described result?
  2. Is there a way to rename the generated navigation properties?

Thanks for your help!

Further technical details

EF Core Power Tools version: 2.4.0.0
Visual Studio version: (Visual Studio 2019 16.4.2)

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 8, 2020

Is it not just a typo: "NewName": "CourseOffering", ??

Otherwise, please provide a CREATE TABLE script and a json file, and I will have a look.

@marcoomeli
Copy link
Author

CREATE TABLE script:

USE [DatabaseName]
GO

/****** Object:  Table [dbo].[tblButton]    Script Date: 08.04.2020 12:44:06 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[tblButton](
	[BuId] [char](3) NOT NULL,
	[BuText] [varchar](50) NOT NULL,
	[BuRolle] [bit] NOT NULL,
	[ModifiedDate] [datetime] NULL,
 CONSTRAINT [PK_tblButton] PRIMARY KEY CLUSTERED 
(
	[BuId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[tblButton] ADD  CONSTRAINT [DF_tblButton_BuRolle]  DEFAULT ((0)) FOR [BuRolle]
GO

Jason File:

[
 {
  "UseSchemaName": false,
  "SchemaName": "dbo",
  "Tables": [
  {
	"Name": "tblButton",
	"NewName": "ButtonBerechtigung",
	"Columns": [
	  {
		"Name": "BuId",
		"NewName": "Id"
	  },
	  {
		"Name": "BuText",
		"NewName": "Text"
	  },
	  {
		"Name": "BuRolle",
		"NewName": "Rolle"
	  }
	]
   }
 ]		
 }
]

Result after reverse engineering:
public virtual DbSet<ButtonBerechtigung> ButtonBerechtigung { get; set; }

Result i would like to get:
public virtual DbSet<ButtonBerechtigung> ButtonBerechtigungEN { get; set; }

ButtonBerechtigungEN is the plural in german.

Greetings from Switzerland.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 8, 2020

There is currently no non-English pluralization, so this is not at all possible.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 8, 2020

Maybe this PR would solve your issue, but I have not had a closer look at it yet. #317

@marcoomeli
Copy link
Author

Ok thanks for your help i will find another solution. But keep in mind then your documentation is not correct. becaause the efpt.renaming.json sample file: which you provide here will not lead to the shown result:

The following efpt.renaming.json sample file will generate these names in the model:
public virtual DbSet< CourseOffering> CourseOfferings { get; set; }

the results then would actualy contain an 's' in the typename aswell:
public virtual DbSet< CourseOfferings> CourseOfferings { get; set; }

@marcoomeli
Copy link
Author

Oh and did you maybe forgot my 2. Question?

Is there a way to rename the generated navigation properties?

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 8, 2020

Thanks, I have removed all the "s" endings from the sample.

Re your second question: Potentially, if I decided to use/merge the above mentioned PR

@ErikEJ ErikEJ closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants