Relationship and CascadeType

How come that I define a relationship in Data Modeler to be Cascade/Cascade and the resulting output is:

    [Association([TAssociationProp.Lazy, TAssociationProp.Required],
    CascadeTypeAll - [TCascadeType.Remove])]
    [JoinColumn('ID_Settings', [TColumnProp.Required], 'ID')]
    FSettings: Proxy<TSettings>;  

I would expect it to be [TCascadeType.SaveUpdate, TCascadeType.Merge, TCascadeType.Remove], but no matter what I try, it keeps generating the above with orphan records as a result.

Manually changing the resulting file is obviously not an option....

Rgds, Mark

Setting Cascade to All in the Associations tab of the TMS Aurelius Exporter, overrides the setting and results in:

   [Association([TAssociationProp.Lazy, TAssociationProp.Required], CascadeTypeAll)]
    [JoinColumn('ID_Settings', [TColumnProp.Required], 'ID')]
    FSettings: Proxy<TSettings>;  

This works and all child records are correctly deleted (if parent entity is deleted).

Why is this required?  Selecting Cascade in the Relationship Editor, leads me to think that this should not be required. Moreover, the override is not required for 1-M associations....


Usually N:1 associations are not expected to be cascade deleted. Your settings could be used by more than one entity, and deleting it would cause a foreign key errors in other objects that still references it. The cascades are there by default, you can modify them using scripts:

Hi Wagner,

My thinking was wrong; the Settings are intended as 1:1 (each entity it's own settings) but you're correct that in reality it could be an N:1.

Instead of a script I manually set the override in the TMS Aurelius Exporter, which works for me.  I am now wondering whether orphaned Settings records could be the problem I had with Serializing/Deserializing (see  I'll continue that discussion in the relevant support case.