TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

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

Update to emit transformed NavPropertyNames #102

Closed dmayhak closed 4 years ago

tonysneed commented 4 years ago

@dmayhak Would you be able to make the requested changes?

codingdna2 commented 4 years ago

I guess similar modifications are required in HbsCSharpEntityTypeGenerator.

codingdna2 commented 4 years ago

I found an additional issue with the usage of TransformNavPropertyName and TransformPropertyName. See commit 3e16d8ff39d1e09012882e305870ef5b09f61c87 and 15ce17fa8d1d7a03dcf86085d85ed23e8e43df15. It was quite hard to fix for me, so maybe a double check is needed

codingdna2 commented 4 years ago

@tonysneed Please check the above. Thanks!

tonysneed commented 4 years ago

If you run the ScaffoldingSample, with Add optional Handlebars transformers uncommented, then you'll see this in OnModelCreating in NorthwindSlimContext:

entity.HasOne(d => d.CustomerFoo)
    .WithOne(p => p.CustomerSettingFoo)
    .HasForeignKey<CustomerSetting>(d => d.CustomerIdFoo)
    .OnDelete(DeleteBehavior.ClientSetNull)
    .HasConstraintName("FK_CustomerSetting_Customer");

Should be CustomerSettingFoo. This will be corrected if you make the changes I requested above.

Aside from this, everything else looks good, as far as I can tell.

tonysneed commented 4 years ago

Let me know when you have made these changes, then we can talk about how to prepare your PR for merging.

codingdna2 commented 4 years ago

I think I did in this commit 4906c14a20d1439258e748a854f91baea92602f0

codingdna2 commented 4 years ago

I’ll run the tests you suggested tomorrow! Thanks for your support!

tonysneed commented 4 years ago

@codingdna2 I don't see your recent commits (4906c14, 3e16d8f) on this PR branch, which is 'master' in fork by @dmayhak. Can you point me to the branch where you pushed you recent commits?

Perhaps you could create a separate PR for your branch? Please see the Contributing Guidelines.

tonysneed commented 4 years ago

Covered by #118.