Skip to content

Commit fd7624b

Browse files
authored
Remove the requirement for an enum property in the collection subsets pattern
1 parent 29b1752 commit fd7624b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

graph/patterns/subsets.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ Existing patterns for this either have special-cased strings or have tightly cou
1616

1717
Have an abstract base class where all variants of the subset are derived types from the base subset. For more information, see the [general subtyping guidance](./subtypes.md).
1818

19-
The abstract base class should also hold an enum for all possible variants. The purpose of including this is to allow for easier ways to do query and filter operations on variants like `all` and `none` without relying on `isof` functions.
19+
The abstract base class may also optionally hold an `enum` for the different variants. If it does, the `enum` must have a member for all possible variants. The purpose of including this is to allow for easier ways to do query and filter operations on variants like `all` and `none` without relying on `isof` functions.
2020

21-
**Base type**
21+
**Base type *without* an enum for the variants**
2222

2323
```xml
24-
<ComplexType Name="membership" IsAbstract="true">
24+
<ComplexType Name="membershipBase" IsAbstract="true" />
25+
```
26+
27+
**Base type *with* an enum for the variants**
28+
29+
```xml
30+
<ComplexType Name="membershipBase" IsAbstract="true">
2531
<Property Name="membershipKind" Type="graph.membershipKind"/>
2632
</ComplexType>
2733

@@ -36,15 +42,15 @@ The abstract base class should also hold an enum for all possible variants. The
3642
**Derived types**
3743

3844
```xml
39-
<ComplexType Name="noMembership" BaseType="graph.membership"/>
45+
<ComplexType Name="noMembership" BaseType="graph.membershipBase"/>
4046

41-
<ComplexType Name="allMembership" BaseType="graph.membership"/>
47+
<ComplexType Name="allMembership" BaseType="graph.membershipBase"/>
4248

43-
<ComplexType Name="enumeratedMembership" BaseType = "graph.membership">
49+
<ComplexType Name="enumeratedMembership" BaseType = "graph.membershipBase">
4450
<Property Name="members" Type="Collection(Edm.String)"/>
4551
</ComplexType>
4652

47-
<ComplexType Name="excludedMembership" BaseType="graph.membership">
53+
<ComplexType Name="excludedMembership" BaseType="graph.membershipBase">
4854
<Property Name="members" Type="Collection(Edm.String)"/>
4955
</ComplexType>
5056
```
@@ -53,7 +59,7 @@ Be aware that the name values and types in the preceding examples are just examp
5359

5460
These pattern type names should satisfy the following naming conventions:
5561

56-
- The base type name should have the suffix `Base`, and the enumeration type name should have the suffix `Kind`.
62+
- The base type name should have the suffix `Base`, and the enumeration type name (if an `enum` is defined) should have the suffix `Kind`.
5763
- Derived child types should have names with enumeration values as the prefixes; for example, if the enumeration member value is `value1`, then the derived type name is `value1<type>`.
5864

5965
```xml

0 commit comments

Comments
 (0)