Skip to content

Commit 22d3f6e

Browse files
tpellissierclaude
andcommitted
Add cascade behavior constants to constants.py
Move cascade behavior string values ("Cascade", "NoCascade", "RemoveLink", "Restrict") to constants.py per PR review feedback. Update CascadeConfiguration to use these constants for its default values. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 22a33d9 commit 22d3f6e

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/PowerPlatform/Dataverse/common/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@
1414
ODATA_TYPE_LOOKUP_ATTRIBUTE = "Microsoft.Dynamics.CRM.LookupAttributeMetadata"
1515
ODATA_TYPE_ONE_TO_MANY_RELATIONSHIP = "Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata"
1616
ODATA_TYPE_MANY_TO_MANY_RELATIONSHIP = "Microsoft.Dynamics.CRM.ManyToManyRelationshipMetadata"
17+
18+
# Cascade behavior values for relationship operations
19+
CASCADE_BEHAVIOR_CASCADE = "Cascade"
20+
CASCADE_BEHAVIOR_NO_CASCADE = "NoCascade"
21+
CASCADE_BEHAVIOR_REMOVE_LINK = "RemoveLink"
22+
CASCADE_BEHAVIOR_RESTRICT = "Restrict"

src/PowerPlatform/Dataverse/models/metadata.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
ODATA_TYPE_LOOKUP_ATTRIBUTE,
2222
ODATA_TYPE_ONE_TO_MANY_RELATIONSHIP,
2323
ODATA_TYPE_MANY_TO_MANY_RELATIONSHIP,
24+
CASCADE_BEHAVIOR_CASCADE,
25+
CASCADE_BEHAVIOR_NO_CASCADE,
26+
CASCADE_BEHAVIOR_REMOVE_LINK,
27+
CASCADE_BEHAVIOR_RESTRICT,
2428
)
2529

2630

@@ -143,12 +147,12 @@ class CascadeConfiguration:
143147
- "Restrict": Prevent the operation if related records exist
144148
"""
145149

146-
assign: str = "NoCascade"
147-
delete: str = "RemoveLink"
148-
merge: str = "NoCascade"
149-
reparent: str = "NoCascade"
150-
share: str = "NoCascade"
151-
unshare: str = "NoCascade"
150+
assign: str = CASCADE_BEHAVIOR_NO_CASCADE
151+
delete: str = CASCADE_BEHAVIOR_REMOVE_LINK
152+
merge: str = CASCADE_BEHAVIOR_NO_CASCADE
153+
reparent: str = CASCADE_BEHAVIOR_NO_CASCADE
154+
share: str = CASCADE_BEHAVIOR_NO_CASCADE
155+
unshare: str = CASCADE_BEHAVIOR_NO_CASCADE
152156
additional_properties: Optional[Dict[str, Any]] = None
153157

154158
def to_dict(self) -> Dict[str, Any]:

0 commit comments

Comments
 (0)