Description
Bug description / exact reproduction steps
Problem
When using EF Core Power Tools to reverse engineer the AreaSessions and AreaSessionAvailabilities tables, which are related in a 1:1 relationship via AreaSessionAvailabilities.AreaSessionId, the properties are being generated with the suffix Dao, which is incorrect. Specifically, the property in the generated AreaSessionDao class for the navigation to AreaSessionAvailabilityDao is generated as:
public virtual AreaSessionAvailabilityDao? AreaSessionAvailabilityDao { get; set; }
This should be generated as:
public virtual AreaSessionAvailabilityDao? AreaSessionAvailability { get; set; }
Steps to Reproduce
Configure reverse engineering in EF Core Power Tools for the AreaSessions and AreaSessionAvailabilities tables.
Set the following renaming for the tables:
AreaSessions -> AreaSessionDao
AreaSessionAvailabilities -> AreaSessionAvailabilityDao
Run the reverse engineering process.
The generated AreaSessionDao class includes a navigation property AreaSessionAvailabilityDao with the wrong suffix.
Expected Behavior
The property should be named AreaSessionAvailability (without the Dao suffix) in the generated AreaSessionDao class.
Additional Information
It would be helpful to allow customization or a configuration option to remove the automatic suffix added to navigation properties, especially in the case of 1:1 relationships.
There you have an example. To reproduce it, I use a SQL Server database to apply the reverse engineering
Your code
-- There the tables used
CREATE TABLE [Assignments].[AreaSessions]
(
[Id] INT NOT NULL,
[EventId] INT NOT NULL
)
CREATE TABLE [Assignments].[AreaSessionAvailabilities] (
[AreaSessionId] INT NOT NULL,
[Capacity] INT NOT NULL DEFAULT 0,
[Availability] INT NOT NULL DEFAULT 0,
CONSTRAINT [PK_Assignment_AreaSessionAvailabilities] PRIMARY KEY CLUSTERED ([AreaSessionId] ASC),
CONSTRAINT [FK_Assignment_AreaSessionAvailabilities_AreaSessions_AreaSessionId] FOREIGN KEY ([AreaSessionId]) REFERENCES [Assignments].[AreaSessions] ([Id]),
PERIOD FOR SYSTEM_TIME ([BeginDate], [EndDate])
)
ALTER TABLE [Assignments].[AreaSessionAvailabilities]
ADD CONSTRAINT UQ_AreaSessionId UNIQUE (AreaSessionId);
Stack traces
EF Core Power Tools version
2.6.911
EF Core Power Tools CLI version
No response
Database provider
SQL Server
Target framework
.NET 8
IDE
No response
Additional features in use
- T4 templates
- SQL Server .dacpac
- Handlebars template