TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

Scaffold EF Core models using Handlebars templates.
MIT License
210 stars 53 forks source link

Access IEntityType from transform functions #170

Closed bdelmeire closed 2 years ago

bdelmeire commented 3 years ago

This PR allows access to entity type from transform functions. Example of use : rename all primary keys ‘TableNameId’ to ‘Id’ services.AddHandlebarsTransformers(propertyTransformer: (e, p) => $"{e.Name}Id" == p.PropertyName ? new EntityPropertyInfo(p.PropertyType, "Id", false) : new EntityPropertyInfo(p.PropertyType, p.PropertyName, p.PropertyIsNullable));

tonysneed commented 3 years ago

Since this is a potentially breaking change, I'll add it to v6, which will be based on EF Core 6.

tonysneed commented 2 years ago

@bdelmeire I am working to merge your PR. The only change I'd like to make is to support both the old and new versions of AddHandlebarsTransformers. I'll update this PR accordingly and then merge.