Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IRelationService

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IRelationService : IService

    Methods

    View Source

    AreRelated(Int32, Int32)

    Checks whether two items are related

    Declaration
    bool AreRelated(int parentId, int childId)
    Parameters
    Type Name Description
    System.Int32 parentId

    Id of the Parent relation

    System.Int32 childId

    Id of the Child relation

    Returns
    Type Description
    System.Boolean

    Returns True if any relations exists with the given Ids, otherwise False

    View Source

    AreRelated(Int32, Int32, String)

    Checks whether two items are related

    Declaration
    bool AreRelated(int parentId, int childId, string relationTypeAlias)
    Parameters
    Type Name Description
    System.Int32 parentId

    Id of the Parent relation

    System.Int32 childId

    Id of the Child relation

    System.String relationTypeAlias

    Alias of the type of relation to create

    Returns
    Type Description
    System.Boolean

    Returns True if any relations exist between the entities, otherwise False

    View Source

    AreRelated(IUmbracoEntity, IUmbracoEntity)

    Checks whether two items are related

    Declaration
    bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child)
    Parameters
    Type Name Description
    IUmbracoEntity parent

    Parent entity

    IUmbracoEntity child

    Child entity

    Returns
    Type Description
    System.Boolean

    Returns True if any relations exist between the entities, otherwise False

    View Source

    AreRelated(IUmbracoEntity, IUmbracoEntity, String)

    Checks whether two items are related

    Declaration
    bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias)
    Parameters
    Type Name Description
    IUmbracoEntity parent

    Parent entity

    IUmbracoEntity child

    Child entity

    System.String relationTypeAlias

    Alias of the type of relation to create

    Returns
    Type Description
    System.Boolean

    Returns True if any relations exist between the entities, otherwise False

    View Source

    Delete(IRelation)

    Deletes a IRelation

    Declaration
    void Delete(IRelation relation)
    Parameters
    Type Name Description
    IRelation relation

    Relation to Delete

    View Source

    Delete(IRelationType)

    Deletes a IRelationType

    Declaration
    void Delete(IRelationType relationType)
    Parameters
    Type Name Description
    IRelationType relationType

    RelationType to Delete

    View Source

    DeleteRelationsOfType(IRelationType)

    Deletes all IRelation objects based on the passed in IRelationType

    Declaration
    void DeleteRelationsOfType(IRelationType relationType)
    Parameters
    Type Name Description
    IRelationType relationType

    IRelationType to Delete Relations for

    View Source

    GetAllRelations(Int32[])

    Gets all IRelation objects

    Declaration
    IEnumerable<IRelation> GetAllRelations(params int[] ids)
    Parameters
    Type Name Description
    System.Int32[] ids

    Optional array of integer ids to return relations for

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetAllRelationsByRelationType(Int32)

    Gets all IRelation objects by their IRelationType's Id

    Declaration
    IEnumerable<IRelation>? GetAllRelationsByRelationType(int relationTypeId)
    Parameters
    Type Name Description
    System.Int32 relationTypeId

    Id of the IRelationType to retrieve Relations for

    Returns
    Type Description
    System.Nullable<IEnumerable<IRelation>>

    An enumerable list of IRelation objects

    View Source

    GetAllRelationsByRelationType(IRelationType)

    Gets all IRelation objects by their IRelationType

    Declaration
    IEnumerable<IRelation>? GetAllRelationsByRelationType(IRelationType relationType)
    Parameters
    Type Name Description
    IRelationType relationType

    IRelation to retrieve Relations for

    Returns
    Type Description
    System.Nullable<IEnumerable<IRelation>>

    An enumerable list of IRelation objects

    View Source

    GetAllRelationTypes(Int32[])

    Gets all IRelation objects

    Declaration
    IEnumerable<IRelationType> GetAllRelationTypes(params int[] ids)
    Parameters
    Type Name Description
    System.Int32[] ids

    Optional array of integer ids to return relationtypes for

    Returns
    Type Description
    IEnumerable<IRelationType>

    An enumerable list of IRelation objects

    View Source

    GetByChild(IUmbracoEntity)

    Gets a list of IRelation objects by their child Entity

    Declaration
    IEnumerable<IRelation> GetByChild(IUmbracoEntity child)
    Parameters
    Type Name Description
    IUmbracoEntity child

    Child Entity to retrieve relations for

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetByChild(IUmbracoEntity, String)

    Gets a list of IRelation objects by their child Entity

    Declaration
    IEnumerable<IRelation> GetByChild(IUmbracoEntity child, string relationTypeAlias)
    Parameters
    Type Name Description
    IUmbracoEntity child

    Child Entity to retrieve relations for

    System.String relationTypeAlias

    Alias of the type of relation to retrieve

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetByChildId(Int32)

    Gets a list of IRelation objects by their child Id

    Declaration
    IEnumerable<IRelation> GetByChildId(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the child to retrieve relations for

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetByChildId(Int32, String)

    Gets a list of IRelation objects by their child Id

    Declaration
    IEnumerable<IRelation> GetByChildId(int id, string relationTypeAlias)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the child to retrieve relations for

    System.String relationTypeAlias

    Alias of the type of relation to retrieve

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetById(Int32)

    Gets a IRelation by its Id

    Declaration
    IRelation GetById(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IRelation

    Returns
    Type Description
    IRelation

    A IRelation object

    View Source

    GetByParent(IUmbracoEntity)

    Gets a list of IRelation objects by their parent entity

    Declaration
    IEnumerable<IRelation>? GetByParent(IUmbracoEntity parent)
    Parameters
    Type Name Description
    IUmbracoEntity parent

    Parent Entity to retrieve relations for

    Returns
    Type Description
    System.Nullable<IEnumerable<IRelation>>

    An enumerable list of IRelation objects

    View Source

    GetByParent(IUmbracoEntity, String)

    Gets a list of IRelation objects by their parent entity

    Declaration
    IEnumerable<IRelation> GetByParent(IUmbracoEntity parent, string relationTypeAlias)
    Parameters
    Type Name Description
    IUmbracoEntity parent

    Parent Entity to retrieve relations for

    System.String relationTypeAlias

    Alias of the type of relation to retrieve

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetByParentAndChildId(Int32, Int32, IRelationType)

    Gets a relation by the unique combination of parentId, childId and relationType.

    Declaration
    IRelation GetByParentAndChildId(int parentId, int childId, IRelationType relationType)
    Parameters
    Type Name Description
    System.Int32 parentId

    The id of the parent item.

    System.Int32 childId

    The id of the child item.

    IRelationType relationType

    The RelationType.

    Returns
    Type Description
    IRelation

    The relation or null

    View Source

    GetByParentId(Int32)

    Gets a list of IRelation objects by their parent Id

    Declaration
    IEnumerable<IRelation>? GetByParentId(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the parent to retrieve relations for

    Returns
    Type Description
    System.Nullable<IEnumerable<IRelation>>

    An enumerable list of IRelation objects

    View Source

    GetByParentId(Int32, String)

    Gets a list of IRelation objects by their parent Id

    Declaration
    IEnumerable<IRelation>? GetByParentId(int id, string relationTypeAlias)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the parent to retrieve relations for

    System.String relationTypeAlias

    Alias of the type of relation to retrieve

    Returns
    Type Description
    System.Nullable<IEnumerable<IRelation>>

    An enumerable list of IRelation objects

    View Source

    GetByParentOrChildId(Int32)

    Gets a list of IRelation objects by their child or parent Id. Using this method will get you all relations regards of it being a child or parent relation.

    Declaration
    IEnumerable<IRelation> GetByParentOrChildId(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the child or parent to retrieve relations for

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetByParentOrChildId(Int32, String)

    Declaration
    IEnumerable<IRelation> GetByParentOrChildId(int id, string relationTypeAlias)
    Parameters
    Type Name Description
    System.Int32 id
    System.String relationTypeAlias
    Returns
    Type Description
    IEnumerable<IRelation>
    View Source

    GetByRelationTypeAlias(String)

    Gets a list of IRelation objects by the Alias of the IRelationType

    Declaration
    IEnumerable<IRelation> GetByRelationTypeAlias(string relationTypeAlias)
    Parameters
    Type Name Description
    System.String relationTypeAlias

    Alias of the IRelationType to retrieve Relations for

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetByRelationTypeId(Int32)

    Gets a list of IRelation objects by the Id of the IRelationType

    Declaration
    IEnumerable<IRelation>? GetByRelationTypeId(int relationTypeId)
    Parameters
    Type Name Description
    System.Int32 relationTypeId

    Id of the IRelationType to retrieve Relations for

    Returns
    Type Description
    System.Nullable<IEnumerable<IRelation>>

    An enumerable list of IRelation objects

    View Source

    GetByRelationTypeName(String)

    Gets a list of IRelation objects by the Name of the IRelationType

    Declaration
    IEnumerable<IRelation> GetByRelationTypeName(string relationTypeName)
    Parameters
    Type Name Description
    System.String relationTypeName

    Name of the IRelationType to retrieve Relations for

    Returns
    Type Description
    IEnumerable<IRelation>

    An enumerable list of IRelation objects

    View Source

    GetChildEntitiesFromRelations(IEnumerable<IRelation>)

    Gets the Child objects from a list of Relations as a list of IUmbracoEntity objects.

    Declaration
    IEnumerable<IUmbracoEntity> GetChildEntitiesFromRelations(IEnumerable<IRelation> relations)
    Parameters
    Type Name Description
    IEnumerable<IRelation> relations

    List of relations to retrieve child objects from

    Returns
    Type Description
    IEnumerable<IUmbracoEntity>

    An enumerable list of IUmbracoEntity

    View Source

    GetChildEntityFromRelation(IRelation)

    Gets the Child object from a Relation as an IUmbracoEntity

    Declaration
    IUmbracoEntity GetChildEntityFromRelation(IRelation relation)
    Parameters
    Type Name Description
    IRelation relation

    Relation to retrieve child object from

    Returns
    Type Description
    IUmbracoEntity

    An IUmbracoEntity

    View Source

    GetEntitiesFromRelation(IRelation)

    Gets the Parent and Child objects from a Relation as a "/> with IUmbracoEntity.

    Declaration
    Tuple<IUmbracoEntity, IUmbracoEntity>? GetEntitiesFromRelation(IRelation relation)
    Parameters
    Type Name Description
    IRelation relation

    Relation to retrieve parent and child object from

    Returns
    Type Description
    System.Nullable<Tuple<IUmbracoEntity, IUmbracoEntity>>

    Returns a Tuple with Parent (item1) and Child (item2)

    View Source

    GetEntitiesFromRelations(IEnumerable<IRelation>)

    Gets the Parent and Child objects from a list of Relations as a list of IUmbracoEntity objects.

    Declaration
    IEnumerable<Tuple<IUmbracoEntity, IUmbracoEntity>> GetEntitiesFromRelations(IEnumerable<IRelation> relations)
    Parameters
    Type Name Description
    IEnumerable<IRelation> relations

    List of relations to retrieve parent and child objects from

    Returns
    Type Description
    IEnumerable<Tuple<IUmbracoEntity, IUmbracoEntity>>

    An enumerable list of with IUmbracoEntity

    View Source

    GetPagedByRelationTypeId(Int32, Int64, Int32, out Int64, Ordering)

    Gets a paged result of IRelation

    Declaration
    IEnumerable<IRelation> GetPagedByRelationTypeId(int relationTypeId, long pageIndex, int pageSize, out long totalRecords, Ordering ordering = null)
    Parameters
    Type Name Description
    System.Int32 relationTypeId
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalRecords
    Ordering ordering
    Returns
    Type Description
    IEnumerable<IRelation>
    View Source

    GetPagedChildEntitiesByParentId(Int32, Int64, Int32, out Int64, UmbracoObjectTypes[])

    Returns paged child entities for a related parent id

    Declaration
    IEnumerable<IUmbracoEntity> GetPagedChildEntitiesByParentId(int id, long pageIndex, int pageSize, out long totalChildren, params UmbracoObjectTypes[] entityTypes)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalChildren
    UmbracoObjectTypes[] entityTypes
    Returns
    Type Description
    IEnumerable<IUmbracoEntity>

    An enumerable list of IUmbracoEntity

    View Source

    GetPagedParentEntitiesByChildId(Int32, Int64, Int32, out Int64, UmbracoObjectTypes[])

    Returns paged parent entities for a related child id

    Declaration
    IEnumerable<IUmbracoEntity> GetPagedParentEntitiesByChildId(int id, long pageIndex, int pageSize, out long totalChildren, params UmbracoObjectTypes[] entityTypes)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalChildren
    UmbracoObjectTypes[] entityTypes
    Returns
    Type Description
    IEnumerable<IUmbracoEntity>

    An enumerable list of IUmbracoEntity

    View Source

    GetParentEntitiesFromRelations(IEnumerable<IRelation>)

    Gets the Parent objects from a list of Relations as a list of IUmbracoEntity objects.

    Declaration
    IEnumerable<IUmbracoEntity> GetParentEntitiesFromRelations(IEnumerable<IRelation> relations)
    Parameters
    Type Name Description
    IEnumerable<IRelation> relations

    List of relations to retrieve parent objects from

    Returns
    Type Description
    IEnumerable<IUmbracoEntity>

    An enumerable list of IUmbracoEntity

    View Source

    GetParentEntityFromRelation(IRelation)

    Gets the Parent object from a Relation as an IUmbracoEntity

    Declaration
    IUmbracoEntity GetParentEntityFromRelation(IRelation relation)
    Parameters
    Type Name Description
    IRelation relation

    Relation to retrieve parent object from

    Returns
    Type Description
    IUmbracoEntity

    An IUmbracoEntity

    View Source

    GetRelationTypeByAlias(String)

    Gets a IRelationType by its Alias

    Declaration
    IRelationType GetRelationTypeByAlias(string alias)
    Parameters
    Type Name Description
    System.String alias

    Alias of the IRelationType

    Returns
    Type Description
    IRelationType

    A IRelationType object

    View Source

    GetRelationTypeById(Guid)

    Gets a IRelationType by its Id

    Declaration
    IRelationType GetRelationTypeById(Guid id)
    Parameters
    Type Name Description
    Guid id

    Id of the IRelationType

    Returns
    Type Description
    IRelationType

    A IRelationType object

    View Source

    GetRelationTypeById(Int32)

    Gets a IRelationType by its Id

    Declaration
    IRelationType GetRelationTypeById(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IRelationType

    Returns
    Type Description
    IRelationType

    A IRelationType object

    View Source

    HasRelations(IRelationType)

    Checks whether any relations exists for the passed in IRelationType.

    Declaration
    bool HasRelations(IRelationType relationType)
    Parameters
    Type Name Description
    IRelationType relationType

    IRelationType to check for relations

    Returns
    Type Description
    System.Boolean

    Returns True if any relations exists for the given IRelationType, otherwise False

    View Source

    IsRelated(Int32)

    Checks whether any relations exists for the passed in Id.

    Declaration
    bool IsRelated(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of an object to check relations for

    Returns
    Type Description
    System.Boolean

    Returns True if any relations exists with the given Id, otherwise False

    View Source

    Relate(Int32, Int32, String)

    Relates two objects by their entity Ids.

    Declaration
    IRelation Relate(int parentId, int childId, string relationTypeAlias)
    Parameters
    Type Name Description
    System.Int32 parentId

    Id of the parent

    System.Int32 childId

    Id of the child

    System.String relationTypeAlias

    Alias of the type of relation to create

    Returns
    Type Description
    IRelation

    The created IRelation

    View Source

    Relate(Int32, Int32, IRelationType)

    Relates two objects by their entity Ids.

    Declaration
    IRelation Relate(int parentId, int childId, IRelationType relationType)
    Parameters
    Type Name Description
    System.Int32 parentId

    Id of the parent

    System.Int32 childId

    Id of the child

    IRelationType relationType

    The type of relation to create

    Returns
    Type Description
    IRelation

    The created IRelation

    View Source

    Relate(IUmbracoEntity, IUmbracoEntity, String)

    Relates two objects that are based on the IUmbracoEntity interface.

    Declaration
    IRelation Relate(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias)
    Parameters
    Type Name Description
    IUmbracoEntity parent

    Parent entity

    IUmbracoEntity child

    Child entity

    System.String relationTypeAlias

    Alias of the type of relation to create

    Returns
    Type Description
    IRelation

    The created IRelation

    View Source

    Relate(IUmbracoEntity, IUmbracoEntity, IRelationType)

    Relates two objects that are based on the IUmbracoEntity interface.

    Declaration
    IRelation Relate(IUmbracoEntity parent, IUmbracoEntity child, IRelationType relationType)
    Parameters
    Type Name Description
    IUmbracoEntity parent

    Parent entity

    IUmbracoEntity child

    Child entity

    IRelationType relationType

    The type of relation to create

    Returns
    Type Description
    IRelation

    The created IRelation

    View Source

    Save(IEnumerable<IRelation>)

    Declaration
    void Save(IEnumerable<IRelation> relations)
    Parameters
    Type Name Description
    IEnumerable<IRelation> relations
    View Source

    Save(IRelation)

    Saves a IRelation

    Declaration
    void Save(IRelation relation)
    Parameters
    Type Name Description
    IRelation relation

    Relation to save

    View Source

    Save(IRelationType)

    Saves a IRelationType

    Declaration
    void Save(IRelationType relationType)
    Parameters
    Type Name Description
    IRelationType relationType

    RelationType to Save

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX