01 / Relations
Define how entities relate to one another.
Product commitmentA shipment's customer relationship is defined once and can be reused wherever it is needed.
Relations make the connections between entities explicit and reusable wherever the system needs to query or enforce them.
Graph resultThe graph now has a reusable, traversable relation with explicit provenance.
var author = RelationQuery.Expression();
var shipments = author.Source<Shipment>();
var customers = author.Traverse<Shipment, Customer>(
shipments,
shipment => shipment.CustomerId);
var summaries = author.Project(
customers,
(Shipment shipment, Customer customer) =>
new ShipmentSummary
{
Id = shipment.Id,
CustomerName = customer.Name
});
var relation = summaries.BuildRelation(summary => summary.Id);