Exemplo n.º 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> >());
        }
Exemplo n.º 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));
 }
Exemplo n.º 3
0
 public static HiveId[] GetDescendantIds(this ICoreReadonlyRelationsRepository session, HiveId sourceId, RelationType relationType)
 {
     return(session.GetDescendentRelations(sourceId, relationType).Select(x => x.DestinationId).ToArray());
 }