Skip to content

Commit 7250de3

Browse files
committed
add csdl example
1 parent d93bea3 commit 7250de3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

graph/patterns/alternate-key.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,42 @@ In such case, the workload has two choices:
4242

4343
The same user identified via the alternate key SSN, the canonical (primary) key ID using the non-canonical long form with specified key property name, and the canonical short form without key property name
4444

45+
Declare `mail` and `ssn` as alternate keys on an entity:
46+
47+
```xml
48+
<EntityType Name="User">
49+
<Key>
50+
<PropertyRef Name="id" />
51+
</Key>
52+
<Property Name="id" Type="Edm.Int32" />
53+
54+
<Property Name="mail" Type="Edm.String" />
55+
<Property Name="ssn" Type="Edm.String" />
56+
<Annotation Term="Keys.AlternateKeys">
57+
<Collection>
58+
<Record>
59+
<PropertyValue Property="Key">
60+
<Collection>
61+
<Record>
62+
<PropertyValue Property="Name" PropertyPath="mail" />
63+
</Record>
64+
</Collection>
65+
</PropertyValue>
66+
</Record>
67+
<Record>
68+
<PropertyValue Property="Key">
69+
<Collection>
70+
<Record>
71+
<PropertyValue Property="Name" PropertyPath="ssn" />
72+
</Record>
73+
</Collection>
74+
</PropertyValue>
75+
</Record>
76+
</Collection>
77+
</Annotation>
78+
</EntityType>
79+
```
80+
4581
1. Get a specific resource through `$filter`:
4682

4783
```http

0 commit comments

Comments
 (0)