Class RelationService
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class RelationService : RepositoryService, IRelationService, IService
Constructors
View SourceRelationService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IEntityService, IRelationRepository, IRelationTypeRepository, IAuditRepository, IUserIdKeyResolver)
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled removal in v19.")]
public RelationService(ICoreScopeProvider uowProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IEntityService entityService, IRelationRepository relationRepository, IRelationTypeRepository relationTypeRepository, IAuditRepository auditRepository, IUserIdKeyResolver userIdKeyResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | uowProvider | |
| ILoggerFactory | loggerFactory | |
| IEventMessagesFactory | eventMessagesFactory | |
| IEntityService | entityService | |
| IRelationRepository | relationRepository | |
| IRelationTypeRepository | relationTypeRepository | |
| IAuditRepository | auditRepository | |
| IUserIdKeyResolver | userIdKeyResolver |
RelationService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IEntityService, IRelationRepository, IRelationTypeRepository, IAuditService, IAuditRepository, IUserIdKeyResolver)
Declaration
[Obsolete("Use the non-obsolete constructor instead. Scheduled removal in v19.")]
public RelationService(ICoreScopeProvider uowProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IEntityService entityService, IRelationRepository relationRepository, IRelationTypeRepository relationTypeRepository, IAuditService auditService, IAuditRepository auditRepository, IUserIdKeyResolver userIdKeyResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | uowProvider | |
| ILoggerFactory | loggerFactory | |
| IEventMessagesFactory | eventMessagesFactory | |
| IEntityService | entityService | |
| IRelationRepository | relationRepository | |
| IRelationTypeRepository | relationTypeRepository | |
| IAuditService | auditService | |
| IAuditRepository | auditRepository | |
| IUserIdKeyResolver | userIdKeyResolver |
RelationService(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, IEntityService, IRelationRepository, IRelationTypeRepository, IAuditService, IUserIdKeyResolver)
Declaration
public RelationService(ICoreScopeProvider uowProvider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IEntityService entityService, IRelationRepository relationRepository, IRelationTypeRepository relationTypeRepository, IAuditService auditService, IUserIdKeyResolver userIdKeyResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreScopeProvider | uowProvider | |
| ILoggerFactory | loggerFactory | |
| IEventMessagesFactory | eventMessagesFactory | |
| IEntityService | entityService | |
| IRelationRepository | relationRepository | |
| IRelationTypeRepository | relationTypeRepository | |
| IAuditService | auditService | |
| IUserIdKeyResolver | userIdKeyResolver |
Methods
View SourceAreRelated(int, int)
Checks whether two items are related
Declaration
public bool AreRelated(int parentId, int childId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | Id of the Parent relation |
| int | childId | Id of the Child relation |
Returns
| Type | Description |
|---|---|
| bool | Returns |
AreRelated(int, int, string)
Checks whether two items are related
Declaration
public bool AreRelated(int parentId, int childId, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | Id of the Parent relation |
| int | childId | Id of the Child relation |
| string | relationTypeAlias | Alias of the type of relation to create |
Returns
| Type | Description |
|---|---|
| bool | Returns |
AreRelated(int, int, IRelationType)
Declaration
public bool AreRelated(int parentId, int childId, IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | |
| int | childId | |
| IRelationType | relationType |
Returns
| Type | Description |
|---|---|
| bool |
AreRelated(IUmbracoEntity, IUmbracoEntity)
Checks whether two items are related
Declaration
public bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoEntity | parent | Parent entity |
| IUmbracoEntity | child | Child entity |
Returns
| Type | Description |
|---|---|
| bool | Returns |
AreRelated(IUmbracoEntity, IUmbracoEntity, string)
Checks whether two items are related
Declaration
public bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoEntity | parent | Parent entity |
| IUmbracoEntity | child | Child entity |
| string | relationTypeAlias | Alias of the type of relation to create |
Returns
| Type | Description |
|---|---|
| bool | Returns |
CountRelationTypes()
Declaration
public int CountRelationTypes()
Returns
| Type | Description |
|---|---|
| int |
CreateAsync(IRelationType, Guid)
Saves a IRelationType
Declaration
public Task<Attempt<IRelationType, RelationTypeOperationStatus>> CreateAsync(IRelationType relationType, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | RelationType to Save |
| Guid | userKey | Key of the user thats saving the relation type |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IRelationType, RelationTypeOperationStatus>> | A Attempt with a status of whether the operations was a success or failure |
Delete(IRelation)
Deletes a IRelation
Declaration
public void Delete(IRelation relation)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelation | relation | Relation to Delete |
Delete(IRelationType)
Deletes a IRelationType
Declaration
public void Delete(IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | RelationType to Delete |
DeleteAsync(Guid, Guid)
Deletes a IRelationType
Declaration
public Task<Attempt<IRelationType?, RelationTypeOperationStatus>> DeleteAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | Key of the relation type to delete |
| Guid | userKey | Key of the user that is deleting the relation type |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IRelationType, RelationTypeOperationStatus>> |
DeleteRelationsOfType(IRelationType)
Deletes all IRelation objects based on the passed in IRelationType
Declaration
public void DeleteRelationsOfType(IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | IRelationType to Delete Relations for |
GetAllRelationTypes(params int[])
Gets all IRelation objects
Declaration
public IEnumerable<IRelationType> GetAllRelationTypes(params int[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | ids | Optional array of integer ids to return relationtypes for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelationType> | An enumerable list of IRelation objects |
GetAllRelations(params int[])
Gets all IRelation objects
Declaration
public IEnumerable<IRelation> GetAllRelations(params int[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | ids | Optional array of integer ids to return relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetAllRelationsByRelationType(int)
Gets all IRelation objects by their IRelationType's Id
Declaration
public IEnumerable<IRelation> GetAllRelationsByRelationType(int relationTypeId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | relationTypeId | Id of the IRelationType to retrieve Relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetAllRelationsByRelationType(IRelationType)
Gets all IRelation objects by their IRelationType
Declaration
public IEnumerable<IRelation> GetAllRelationsByRelationType(IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | IRelation to retrieve Relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetAllowedObjectTypes()
Gets all allowed parent/child object types for a given IRelationType />
Declaration
public IEnumerable<UmbracoObjectTypes> GetAllowedObjectTypes()
Returns
| Type | Description |
|---|---|
| IEnumerable<UmbracoObjectTypes> | All of the allowed UmbracoObjectTypes. |
GetByChild(IUmbracoEntity)
Gets a list of IRelation objects by their child Entity
Declaration
public 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 |
GetByChild(IUmbracoEntity, string)
Gets a list of IRelation objects by their child Entity
Declaration
public IEnumerable<IRelation> GetByChild(IUmbracoEntity child, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoEntity | child | Child Entity to retrieve relations for |
| string | relationTypeAlias | Alias of the type of relation to retrieve |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByChildId(int)
Gets a list of IRelation objects by their child Id
Declaration
public IEnumerable<IRelation> GetByChildId(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the child to retrieve relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByChildId(int, string?)
Gets a list of IRelation objects by their child Id
Declaration
public IEnumerable<IRelation> GetByChildId(int id, string? relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the child to retrieve relations for |
| string | relationTypeAlias | Alias of the type of relation to retrieve |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetById(int)
Gets a IRelation by its Id
Declaration
public IRelation? GetById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the IRelation |
Returns
| Type | Description |
|---|---|
| IRelation | A IRelation object |
GetByParent(IUmbracoEntity)
Gets a list of IRelation objects by their parent entity
Declaration
public IEnumerable<IRelation> GetByParent(IUmbracoEntity parent)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoEntity | parent | Parent Entity to retrieve relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByParent(IUmbracoEntity, string)
Gets a list of IRelation objects by their parent entity
Declaration
public IEnumerable<IRelation> GetByParent(IUmbracoEntity parent, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoEntity | parent | Parent Entity to retrieve relations for |
| string | relationTypeAlias | Alias of the type of relation to retrieve |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByParentAndChildId(int, int, IRelationType)
Gets a relation by the unique combination of parentId, childId and relationType.
Declaration
public IRelation? GetByParentAndChildId(int parentId, int childId, IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | The id of the parent item. |
| int | childId | The id of the child item. |
| IRelationType | relationType | The RelationType. |
Returns
| Type | Description |
|---|---|
| IRelation | The relation or null |
GetByParentId(int)
Gets a list of IRelation objects by their parent Id
Declaration
public IEnumerable<IRelation> GetByParentId(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the parent to retrieve relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByParentId(int, string?)
Gets a list of IRelation objects by their parent Id
Declaration
public IEnumerable<IRelation> GetByParentId(int id, string? relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the parent to retrieve relations for |
| string | relationTypeAlias | Alias of the type of relation to retrieve |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByParentOrChildId(int)
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
public IEnumerable<IRelation> GetByParentOrChildId(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the child or parent to retrieve relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByParentOrChildId(int, string)
Declaration
public IEnumerable<IRelation> GetByParentOrChildId(int id, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| string | relationTypeAlias |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> |
GetByRelationTypeAlias(string)
Gets a list of IRelation objects by the Alias of the IRelationType
Declaration
public IEnumerable<IRelation> GetByRelationTypeAlias(string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | relationTypeAlias | Alias of the IRelationType to retrieve Relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByRelationTypeId(int)
Gets a list of IRelation objects by the Id of the IRelationType
Declaration
public IEnumerable<IRelation> GetByRelationTypeId(int relationTypeId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | relationTypeId | Id of the IRelationType to retrieve Relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetByRelationTypeName(string)
Gets a list of IRelation objects by the Name of the IRelationType
Declaration
public IEnumerable<IRelation> GetByRelationTypeName(string relationTypeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | relationTypeName | Name of the IRelationType to retrieve Relations for |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | An enumerable list of IRelation objects |
GetChildEntitiesFromRelations(IEnumerable<IRelation>)
Gets the Child objects from a list of Relations as a list of IUmbracoEntity objects.
Declaration
public 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 |
GetChildEntityFromRelation(IRelation)
Gets the Child object from a Relation as an IUmbracoEntity
Declaration
public IUmbracoEntity? GetChildEntityFromRelation(IRelation relation)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelation | relation | Relation to retrieve child object from |
Returns
| Type | Description |
|---|---|
| IUmbracoEntity |
GetEntitiesFromRelation(IRelation)
Gets the Parent and Child objects from a Relation as a System.Tuple"/> with IUmbracoEntity.
Declaration
public Tuple<IUmbracoEntity, IUmbracoEntity>? GetEntitiesFromRelation(IRelation relation)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelation | relation | Relation to retrieve parent and child object from |
Returns
| Type | Description |
|---|---|
| Tuple<IUmbracoEntity, IUmbracoEntity> | Returns a Tuple with Parent (item1) and Child (item2) |
GetEntitiesFromRelations(IEnumerable<IRelation>)
Gets the Parent and Child objects from a list of Relations as a list of IUmbracoEntity objects.
Declaration
public 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 System.Tuple with IUmbracoEntity |
GetPagedByChildKeyAsync(Guid, int, int, string?)
Declaration
public Task<PagedModel<IRelation>> GetPagedByChildKeyAsync(Guid childKey, int skip, int take, string? relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | childKey | |
| int | skip | |
| int | take | |
| string | relationTypeAlias |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<IRelation>> |
GetPagedByRelationTypeId(int, long, int, out long, Ordering?)
Gets a paged result of IRelation
Declaration
public IEnumerable<IRelation> GetPagedByRelationTypeId(int relationTypeId, long pageIndex, int pageSize, out long totalRecords, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | relationTypeId | |
| long | pageIndex | |
| int | pageSize | |
| long | totalRecords | |
| Ordering | ordering |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> |
GetPagedByRelationTypeKeyAsync(Guid, int, int, Ordering?)
Gets a paged result of IRelation
Declaration
public Task<Attempt<PagedModel<IRelation>, RelationOperationStatus>> GetPagedByRelationTypeKeyAsync(Guid key, int skip, int take, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | |
| int | skip | |
| int | take | |
| Ordering | ordering |
Returns
| Type | Description |
|---|---|
| Task<Attempt<PagedModel<IRelation>, RelationOperationStatus>> |
GetPagedChildEntitiesByParentId(int, long, int, out long, params UmbracoObjectTypes[])
Returns paged child entities for a related parent id
Declaration
public IEnumerable<IUmbracoEntity> GetPagedChildEntitiesByParentId(int id, long pageIndex, int pageSize, out long totalChildren, params UmbracoObjectTypes[] entityTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| long | pageIndex | |
| int | pageSize | |
| long | totalChildren | |
| UmbracoObjectTypes[] | entityTypes |
Returns
| Type | Description |
|---|---|
| IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity |
GetPagedParentEntitiesByChildId(int, long, int, out long, params UmbracoObjectTypes[])
Returns paged parent entities for a related child id
Declaration
public IEnumerable<IUmbracoEntity> GetPagedParentEntitiesByChildId(int id, long pageIndex, int pageSize, out long totalChildren, params UmbracoObjectTypes[] entityTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| long | pageIndex | |
| int | pageSize | |
| long | totalChildren | |
| UmbracoObjectTypes[] | entityTypes |
Returns
| Type | Description |
|---|---|
| IEnumerable<IUmbracoEntity> | An enumerable list of IUmbracoEntity |
GetPagedRelationTypesAsync(int, int, params int[])
Gets the Relation types in a paged manner. Currently implements the paging in memory on the name property because the underlying repository does not support paging yet
Declaration
public Task<PagedModel<IRelationType>> GetPagedRelationTypesAsync(int skip, int take, params int[] ids)
Parameters
| Type | Name | Description |
|---|---|---|
| int | skip | |
| int | take | |
| int[] | ids |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<IRelationType>> |
GetParentEntitiesFromRelations(IEnumerable<IRelation>)
Gets the Parent objects from a list of Relations as a list of IUmbracoEntity objects.
Declaration
public 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 |
GetParentEntityFromRelation(IRelation)
Gets the Parent object from a Relation as an IUmbracoEntity
Declaration
public IUmbracoEntity? GetParentEntityFromRelation(IRelation relation)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelation | relation | Relation to retrieve parent object from |
Returns
| Type | Description |
|---|---|
| IUmbracoEntity |
GetRelationTypeByAlias(string)
Gets a IRelationType by its Alias
Declaration
public IRelationType? GetRelationTypeByAlias(string alias)
Parameters
| Type | Name | Description |
|---|---|---|
| string | alias | Alias of the IRelationType |
Returns
| Type | Description |
|---|---|
| IRelationType | A IRelationType object |
GetRelationTypeById(Guid)
Gets a IRelationType by its Id
Declaration
public IRelationType? GetRelationTypeById(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | Id of the IRelationType |
Returns
| Type | Description |
|---|---|
| IRelationType | A IRelationType object |
GetRelationTypeById(int)
Gets a IRelationType by its Id
Declaration
public IRelationType? GetRelationTypeById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of the IRelationType |
Returns
| Type | Description |
|---|---|
| IRelationType | A IRelationType object |
HasRelations(IRelationType)
Checks whether any relations exists for the passed in IRelationType.
Declaration
public bool HasRelations(IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | IRelationType to check for relations |
Returns
| Type | Description |
|---|---|
| bool | Returns |
IsRelated(int)
Declaration
[Obsolete("No longer used in Umbraco, please the overload taking all parameters. Scheduled for removal in Umbraco 19.")]
public bool IsRelated(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| bool |
IsRelated(int, RelationDirectionFilter)
Checks whether any relations exists for the passed in Id and direction.
Declaration
[Obsolete("Please the overload taking all parameters. Scheduled for removal in Umbraco 18.")]
public bool IsRelated(int id, RelationDirectionFilter directionFilter)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of an object to check relations for |
| RelationDirectionFilter | directionFilter | Indicates whether to check for relations as parent, child or in either direction. |
Returns
| Type | Description |
|---|---|
| bool | Returns |
IsRelated(int, RelationDirectionFilter, int[]?, int[]?)
Checks whether any relations exists for the passed in Id and direction.
Declaration
public bool IsRelated(int id, RelationDirectionFilter directionFilter, int[]? includeRelationTypeIds = null, int[]? excludeRelationTypeIds = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | Id of an object to check relations for |
| RelationDirectionFilter | directionFilter | Indicates whether to check for relations as parent, child or in either direction. |
| int[] | includeRelationTypeIds | A collection of relation type Ids to include consideration in the relation checks. |
| int[] | excludeRelationTypeIds | A collection of relation type Ids to exclude from consideration in the relation checks. |
Returns
| Type | Description |
|---|---|
| bool | Returns |
Remarks
If no relation type Ids are provided in includeRelationTypeIds or excludeRelationTypeIds, all relation type Ids are considered.
Relate(int, int, string)
Relates two objects by their entity Ids.
Declaration
public IRelation Relate(int parentId, int childId, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | Id of the parent |
| int | childId | Id of the child |
| string | relationTypeAlias | Alias of the type of relation to create |
Returns
| Type | Description |
|---|---|
| IRelation | The created IRelation |
Relate(int, int, IRelationType)
Relates two objects by their entity Ids.
Declaration
public IRelation Relate(int parentId, int childId, IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | Id of the parent |
| int | childId | Id of the child |
| IRelationType | relationType | The type of relation to create |
Returns
| Type | Description |
|---|---|
| IRelation | The created IRelation |
Relate(IUmbracoEntity, IUmbracoEntity, string)
Relates two objects that are based on the IUmbracoEntity interface.
Declaration
public IRelation Relate(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IUmbracoEntity | parent | Parent entity |
| IUmbracoEntity | child | Child entity |
| string | relationTypeAlias | Alias of the type of relation to create |
Returns
| Type | Description |
|---|---|
| IRelation | The created IRelation |
Relate(IUmbracoEntity, IUmbracoEntity, IRelationType)
Relates two objects that are based on the IUmbracoEntity interface.
Declaration
public 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 |
Save(IEnumerable<IRelation>)
Declaration
public void Save(IEnumerable<IRelation> relations)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IRelation> | relations |
Save(IRelation)
Saves a IRelation
Declaration
public void Save(IRelation relation)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelation | relation | Relation to save |
Save(IRelationType)
Saves a IRelationType
Declaration
public void Save(IRelationType relationType)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | RelationType to Save |
UpdateAsync(IRelationType, Guid)
Saves a IRelationType
Declaration
public Task<Attempt<IRelationType, RelationTypeOperationStatus>> UpdateAsync(IRelationType relationType, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IRelationType | relationType | RelationType to Save |
| Guid | userKey | Key of the user thats saving the relation type |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IRelationType, RelationTypeOperationStatus>> | A Attempt with a status of whether the operations was a success or failure |