Skip to content

Commit 6c2789b

Browse files
authored
Update collections.md
1 parent 3781028 commit 6c2789b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

graph/articles/collections.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ If there's an entity type `foo` that has a collection of `bar`s:
329329

330330
```xml
331331
<EntityType Name="foo">
332+
<Key>
333+
<PropertyRef Name="id" />
334+
</Key>
335+
<Property Name="id" Type="Edm.String" Nullable="false" />
332336
<Property Name="bars" Type="Collection(self.bar)" />
333337
</EntityType>
334338

@@ -338,9 +342,12 @@ If there's an entity type `foo` that has a collection of `bar`s:
338342
</ComplexType>
339343
```
340344
and a scenario arises that requires, for example, to remove individual `bar`s from the collection, the model can be updated to have two collections side-by-side:
341-
342345
```diff
343346
<EntityType Name="foo">
347+
<Key>
348+
<PropertyRef Name="id" />
349+
</Key>
350+
<Property Name="id" Type="Edm.String" Nullable="false" />
344351
<Property Name="bars" Type="Collection(self.bar)" />
345352
+ <Property Name="barsAsEntities" Type="Collection(self.barAsEntity)" />
346353
</EntityType>
@@ -358,5 +365,11 @@ and a scenario arises that requires, for example, to remove individual `bar`s fr
358365
+ <Property Name="prop2" Type="Edm.String" />
359366
+</EntityType>
360367
```
368+
Clients will now be able to refer to individual `bar`s using `prop1` as a key, and they can now remove those `bar`s using `DELETE` requests:
369+
```http
370+
DELETE /foos/{fooId}/bars/{some_prop1}
371+
```
372+
```json
373+
```
361374

362375
### 11.2 TODO $select trickery

0 commit comments

Comments
 (0)