Hi,
The example shows both: explicit and implicit relationships. It could maybe be 2 separate demos, but we already have too much demos...
Categories is implicitly related to Elements, because the class Catergories contains an array of Elements. Note that there is no added relationship between Elements and Categories, and we don't even call AddTable("Elements"). Elements is implicitly added when we add Categories.
On the other hand, the table Elements is not related at all with ElementNames. ElementNames is just a List<ElementName> and there is no information for FlexCel to know which elements in ElementName map to which elements in Elements. So to relate Elements and ElementNames, you need to add an explicit relationship:
report.AddRelationship("Elements", "ElementName", "ElementID", "ElementID");
So we have 3 tables in this report:
Categories
Elements: Implicitly related to Categories
ElementName: Not related to Categories or Elements, so we need an explicit relationship.
Of course the example is not how most real world apps will work. You will likely have all implicit relationships (so ElementName would be a property in the table Elements), or you will have all explicit (Categories, Elements and ElementName would be 3 independent tables, and you would relate them explicitly with AddRelationship).
But you can mix and match as in this example, sometimes it makes sense, and this way we have a simple demo to show both. As said, they could be separate demos (LINQ with explicit relationships/ LINQ with implicit relationships), but I don't think it is worth.