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> GetAncestorRelations(this ICoreReadonlyRelationsRepository session, IRelatableEntity descendent, RelationType relationType = null)
 {
     Mandate.ParameterNotNull(descendent, "descendent");
     return(session.GetAncestorRelations(descendent.Id, relationType));
 }
Exemplo n.º 3
0
 private static HiveId[] GetAncestorRelationSourceIds(this ICoreReadonlyRelationsRepository session, RelationType relationType, HiveId sourceId)
 {
     return(session.GetAncestorRelations(sourceId, relationType).Select(x => x.SourceId).ToArray());
 }