[EF Core 7] T4 scaffolding - Rename entities and files generated by code templates
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Was looking into changing (adding a post fix) names of generated types. Problem is with the data context generation for the foreign keys that require type argument `<#= code.Fragment(foreignKeyFluentApiCalls, indent: 4) #>`. How do one unwrap the `foreignKeyFluentApiCalls` to substitute the type name?
```c#
entity.HasOne(d => d.<#= foreignKey.DependentToPrincipal.Name #>).<#= foreignKey.IsUnique ? "WithOne" : "WithMany" #>(p => p.<#= foreignKey.PrincipalToDependent.Name #>)<#= code.Fragment(foreignKeyFluentApiCalls, indent: 4) #>;
```
Also is there a way to change file names for generated models from `EntityType.t4` template?
EF Core version: 7.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 7.0
Operating system: Win 11
IDE: (e.g. Visual Studio 2022 17.4
Contributor guide
Assessment
This issue has not been assessed yet.