msawczyn / EFDesigner2022

Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
MIT License
123 stars 21 forks source link

OnDelete is missing on output #24

Closed slargollo closed 2 years ago

slargollo commented 2 years ago

When using EFCore5ModelGenerator and SourceMultiplicity is One or ZeroOne, OnDelete is not being generating. I've had to change the method WriteBidirectionalNonDependentAssociations to corrected that:

              case Sawczyn.EFDesigner.EFModel.Multiplicity.One:
              case Sawczyn.EFDesigner.EFModel.Multiplicity.ZeroOne:
                 segments.Add($"WithOne(p => p.{association.SourcePropertyName})");
                 // Force output of OnDelete
                 **WriteSourceDeleteBehavior(association, segments);**
                 break;
msawczyn commented 2 years ago

Thanks for the catch. The fix will be in the next release.