efcore / EFCore.NamingConventions

Entity Framework Core plugin to apply naming conventions to table and column names (e.g. snake_case)
Apache License 2.0
759 stars 75 forks source link

Added 'FK property changed' convention and test. #215

Closed matheus-inacio closed 10 months ago

matheus-inacio commented 1 year ago

Implementation of the IForeignKeyPropertiesChangedConvention'.

PS.: The test implemented covers what triggered the issue for me.

EF core does not automatically maps properties without setters. https://github.com/dotnet/efcore/issues/10844#issuecomment-362338017

In case you define an ID without a setter, EF will map it as "Keyless" and add "temp" to the FK constraint names.

Once you define an ID manually, the constraints name are never corrected since ForeignKeyPropertiesChangedConventions is not implemented.

Fixes issues: https://github.com/efcore/EFCore.NamingConventions/issues/148, https://github.com/efcore/EFCore.NamingConventions/issues/198

Pre-existing PR: https://github.com/efcore/EFCore.NamingConventions/pull/149

image

roji commented 10 months ago

@matheus-inacio sorry it took so long to get around to this... I've submitted your fix as #244 (as this PR isn't writable), fixing a small test issue.

Thanks for your contribution!