TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

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

Transforming Property Names Issue #98

Closed richardcroprecords closed 4 years ago

richardcroprecords commented 4 years ago

When I transform property names the context still refers to the untransformed property.

        services.AddHandlebarsTransformers(
            entityNameTransformer: n => n + "Foo",
            entityFileNameTransformer: n => n + "Foo",
            constructorTransformer: e => new EntityPropertyInfo(e.PropertyType, e.PropertyName + "Foo"),
            propertyTransformer: e => new EntityPropertyInfo(e.PropertyType, e.PropertyName + "Foo"),
            navPropertyTransformer: e => new EntityPropertyInfo(e.PropertyType, e.PropertyName + "Foo"));

In the generated class:

    public long? DeletedFoo { get; set; }

In the generated context:

            entity.Property(e => e.Deleted)
                .HasColumnName("deleted")
                .HasDefaultValueSql("0");
codingdna2 commented 4 years ago

I guess PR #102 address this?

I add that it would be nice not to have to include all the parameters (if I transform only entityName, constructor and navProperties should be generated accordingly).

birtej commented 4 years ago

I'm not sure if this covers it, but transformed entity names are also not being used in generated constraints

tonysneed commented 4 years ago

Closed by #118