Interface IRelationRepository
Represents a repository for IRelation entities.
Namespace: Umbraco.Cms.Core.Persistence.Repositories
Assembly: Umbraco.Core.dll
Syntax
public interface IRelationRepository : IReadWriteQueryRepository<int, IRelation>, IReadRepository<int, IRelation>, IWriteRepository<IRelation>, IQueryRepository<IRelation>, IRepository
Methods
View SourceDeleteByParent(int, params string[])
Deletes all relations for a parent for any specified relation type alias
Declaration
void DeleteByParent(int parentId, params string[] relationTypeAliases)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | |
| string[] | relationTypeAliases | A list of relation types to match for deletion, if none are specified then all relations for this parent id are deleted. |
GetPagedByChildKeyAsync(Guid, int, int, string?)
Gets paged relations by child entity key.
Declaration
Task<PagedModel<IRelation>> GetPagedByChildKeyAsync(Guid childKey, int skip, int take, string? relationTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | childKey | The unique key of the child entity. |
| int | skip | The number of records to skip. |
| int | take | The number of records to take. |
| string | relationTypeAlias | The relation type alias to filter by, or |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<IRelation>> | A paged model of relations. |
GetPagedChildEntitiesByParentId(int, long, int, out long, params Guid[])
Gets paged child entities for a parent entity.
Declaration
IEnumerable<IUmbracoEntity> GetPagedChildEntitiesByParentId(int parentId, long pageIndex, int pageSize, out long totalRecords, params Guid[] entityTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | The identifier of the parent entity. |
| long | pageIndex | The page index. |
| int | pageSize | The page size. |
| long | totalRecords | Returns the total number of records. |
| Guid[] | entityTypes | The entity types to filter by. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IUmbracoEntity> | A collection of child entities for the specified page. |
GetPagedParentEntitiesByChildId(int, long, int, out long, params Guid[])
Gets paged parent entities for a child entity.
Declaration
IEnumerable<IUmbracoEntity> GetPagedParentEntitiesByChildId(int childId, long pageIndex, int pageSize, out long totalRecords, params Guid[] entityTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| int | childId | The identifier of the child entity. |
| long | pageIndex | The page index. |
| int | pageSize | The page size. |
| long | totalRecords | Returns the total number of records. |
| Guid[] | entityTypes | The entity types to filter by. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IUmbracoEntity> | A collection of parent entities for the specified page. |
GetPagedRelationsByQuery(IQuery<IRelation>?, long, int, out long, Ordering?)
Gets paged relations matching the specified query.
Declaration
IEnumerable<IRelation> GetPagedRelationsByQuery(IQuery<IRelation>? query, long pageIndex, int pageSize, out long totalRecords, Ordering? ordering)
Parameters
| Type | Name | Description |
|---|---|---|
| IQuery<IRelation> | query | The query to apply, or |
| long | pageIndex | The page index. |
| int | pageSize | The page size. |
| long | totalRecords | Returns the total number of records. |
| Ordering | ordering | The ordering to apply, or |
Returns
| Type | Description |
|---|---|
| IEnumerable<IRelation> | A collection of relations for the specified page. |
Save(IEnumerable<IRelation>)
Persist multiple IRelation at once
Declaration
void Save(IEnumerable<IRelation> relations)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IRelation> | relations |
SaveBulk(IEnumerable<ReadOnlyRelation>)
Persist multiple IRelation at once but Ids are not returned on created relations
Declaration
void SaveBulk(IEnumerable<ReadOnlyRelation> relations)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ReadOnlyRelation> | relations |