public static IEnumerable <IRelationById> GetRelations(this ICoreReadonlyRelationsRepository session, HiveId sourceId, Direction direction, RelationType relationType = null) { switch (direction) { case Direction.Ancestors: return(session.GetAncestorRelations(sourceId, relationType)); case Direction.Children: return(session.GetChildRelations(sourceId, relationType)); case Direction.Descendents: return(session.GetDescendentRelations(sourceId, relationType)); case Direction.Parents: return(session.GetParentRelations(sourceId, relationType)); } return(Enumerable.Empty <IReadonlyRelation <IRelatableEntity, IRelatableEntity> >()); }
public static IEnumerable <IRelationById> GetAncestorRelations(this ICoreReadonlyRelationsRepository session, IRelatableEntity descendent, RelationType relationType = null) { Mandate.ParameterNotNull(descendent, "descendent"); return(session.GetAncestorRelations(descendent.Id, relationType)); }
private static HiveId[] GetAncestorRelationSourceIds(this ICoreReadonlyRelationsRepository session, RelationType relationType, HiveId sourceId) { return(session.GetAncestorRelations(sourceId, relationType).Select(x => x.SourceId).ToArray()); }