Example #1
0
        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> >());
        }
Example #2
0
 public static IEnumerable <IRelationById> GetDescendentRelations(this ICoreReadonlyRelationsRepository session, IRelatableEntity ancestor, RelationType relationType = null)
 {
     Mandate.ParameterNotNull(ancestor, "ancestor");
     return(session.GetDescendentRelations(ancestor.Id, relationType));
 }
Example #3
0
 public static HiveId[] GetDescendantIds(this ICoreReadonlyRelationsRepository session, HiveId sourceId, RelationType relationType)
 {
     return(session.GetDescendentRelations(sourceId, relationType).Select(x => x.DestinationId).ToArray());
 }