Skip to content

Commit 3781028

Browse files
authored
Update collections.md
1 parent e7f42d8 commit 3781028

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

graph/articles/collections.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,38 @@ Sometimes, structural collection properties are added to a type and then scenari
325325

326326
### 11.1 TODO side-by-side
327327

328+
If there's an entity type `foo` that has a collection of `bar`s:
329+
330+
```xml
331+
<EntityType Name="foo">
332+
<Property Name="bars" Type="Collection(self.bar)" />
333+
</EntityType>
334+
335+
<ComplexType Name="bar">
336+
<Property Name="prop1" Type="Edm.String" />
337+
<Property Name="prop2" Type="Edm.String" />
338+
</ComplexType>
339+
```
340+
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+
342+
```diff
343+
<EntityType Name="foo">
344+
<Property Name="bars" Type="Collection(self.bar)" />
345+
+ <Property Name="barsAsEntities" Type="Collection(self.barAsEntity)" />
346+
</EntityType>
347+
348+
<ComplexType Name="bar">
349+
<Property Name="prop1" Type="Edm.String" />
350+
<Property Name="prop2" Type="Edm.String" />
351+
</ComplexType>
352+
353+
+<EntityType Name="barAsEntity">
354+
+ <Key>
355+
+ <PropertyRef Name="prop1" />
356+
+ </Key>
357+
+ <Property Name="prop1" Type="Edm.String" />
358+
+ <Property Name="prop2" Type="Edm.String" />
359+
+</EntityType>
360+
```
361+
328362
### 11.2 TODO $select trickery

0 commit comments

Comments
 (0)