Reverse Engineer - Rename navigation and reference properties
See original GitHub issueIs it possible to rename the generated navigation properties?
Steps to reproduce
Say there are two tables,
CREATE TABLE Product ( Id UNIQUEIDENTIFIER NOT NULL PRIMARY KEY, CategoryCode VARCHAR(20) FOREIGN KEY (CategoryCode) REFERENCES Category (Code) NULL, ParentId UNIQUEIDENTIFIER FOREIGN KEY (ParentId) REFERENCES Product (Id) NULL )
CREATE TABLE Category ( Code VARCHAR(20) NOT NULL PRIMARY KEY, Description VARCHAR(100) NOT NULL )
Product table references both Category and Product itself. The generated class contains the following navigation properties, which I very much want to rename to something more meaningful.
public Category CategoryCodeNavigation { get; set; }
public Product ParentProduct {get;set;}
public virtual ICollection<Product> InverseProduct {get; set;}
I have tried to use efpt.renaming.json, but it only supports renaming columns not FK relations.
I understand I can just manually rename the properties after the code-gen, but the changes will be overwritten when the project is re-generated which we do quite often.
So is there a workaround to rename FK navigation properties?
Thanks for any tips!
Further technical details
EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu) 2.2.12.0
Database engine: (SQlite, SQL Compact, SQL Server, Postgres) Azure SQL
Visual Studio version: (e.g. Visual Studio 2017 15.7) VS2019
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:52 (23 by maintainers)
Top GitHub Comments
Not something I plan to implement
Another attempt at this is now in preview, more confidence this time (using Roslyn for consisten renaming) - https://github.com/ErikEJ/EFCorePowerTools/wiki/Reverse-Engineering#custom-renaming-with-efptproperty-renamingjson