src/Misc/EFTools/EntityDesignDatabaseGeneration/MetadataWorkspaceExtensions.cs
/// <summary>
///     This will get the value of the OnDelete element on the AssociationEnd
///     1. This will return 'None' if the end and its sibling end have 'Cascade' specified
///     2. This will return 'None' if the end's multiplicity is Many (*)
/// </summary>
/// <param name="end">The AssociationEnd.</param>
/// <returns>The value of the OnDelete element.</returns>
This will get the value of the OnDelete element on the AssociationEnd
1. This will return 'None' if the end and its sibling end have 'Cascade' specified
2. This will return 'None' if the end's multiplicity is Many (*)
This will get the value of the OnDelete element on the AssociationEnd 1 . This will return ' None ' if the end and its sibling end have ' Cascade ' specified 2 . This will return ' None ' if the end ' s multiplicity is Many ( * )
public static OperationAction GetOnDelete(this AssociationEndMember end)
        {
            var association = end.DeclaringType as AssociationType;
            if (association != null)
            {
                AssociationEndMember otherEnd = association.GetOtherEnd(end);
                if (otherEnd != null)
                {
                    if (end.DeleteBehavior == OperationAction.Cascade
                        &&
                        otherEnd.DeleteBehavior == OperationAction.Cascade)
                    {
                        return OperationAction.None;
                    }
                }
            }
            if (end.RelationshipMultiplicity == RelationshipMultiplicity.Many)
            {
                return OperationAction.None;
            }
            return end.DeleteBehavior;
        }
public static OperationAction GetOnDelete ( this AssociationEndMember end ) { var association = end . DeclaringType as AssociationType ; if ( association != null ) { AssociationEndMember otherEnd = association . GetOtherEnd ( end ) ; if ( otherEnd != null ) { if ( end . DeleteBehavior == OperationAction . Cascade && otherEnd . DeleteBehavior == OperationAction . Cascade ) { return OperationAction . None ; } } } if ( end . RelationshipMultiplicity == RelationshipMultiplicity . Many ) { return OperationAction . None ; } return end . DeleteBehavior ; }
This will get the value of the OnDelete element on the AssociationEnd
1.
This will get the value of the OnDelete element on the AssociationEnd 1 .
The value of the OnDelete element.
The value of the OnDelete element .
AssociationEndMember
this
end
None