Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IEntityRepository

    Represents a repository for lightweight entity operations.

    Namespace: Umbraco.Cms.Core.Persistence.Repositories
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IEntityRepository : IRepository

    Methods

    View Source

    CountByQuery(IQuery<IUmbracoEntity>, IEnumerable<Guid>, IQuery<IUmbracoEntity>?)

    Counts entities matching a query for multiple object types.

    Declaration
    int CountByQuery(IQuery<IUmbracoEntity> query, IEnumerable<Guid> objectTypes, IQuery<IUmbracoEntity>? filter)
    Parameters
    Type Name Description
    IQuery<IUmbracoEntity> query

    The query to apply.

    IEnumerable<Guid> objectTypes

    The object type identifiers.

    IQuery<IUmbracoEntity> filter

    An optional filter query.

    Returns
    Type Description
    int

    The count of entities matching the query.

    View Source

    CountByQuery(IQuery<IUmbracoEntity>, Guid, IQuery<IUmbracoEntity>?)

    Counts entities matching a query for a specific object type.

    Declaration
    int CountByQuery(IQuery<IUmbracoEntity> query, Guid objectType, IQuery<IUmbracoEntity>? filter)
    Parameters
    Type Name Description
    IQuery<IUmbracoEntity> query

    The query to apply.

    Guid objectType

    The object type identifier.

    IQuery<IUmbracoEntity> filter

    An optional filter query.

    Returns
    Type Description
    int

    The count of entities matching the query.

    View Source

    Exists(IEnumerable<Guid>)

    Checks whether entities with the specified unique keys exist.

    Declaration
    bool Exists(IEnumerable<Guid> keys)
    Parameters
    Type Name Description
    IEnumerable<Guid> keys

    The unique keys of the entities.

    Returns
    Type Description
    bool

    true if all entities exist; otherwise, false.

    View Source

    Exists(Guid)

    Checks whether an entity with the specified unique key exists.

    Declaration
    bool Exists(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique key of the entity.

    Returns
    Type Description
    bool

    true if the entity exists; otherwise, false.

    View Source

    Exists(Guid, Guid)

    Asserts if an entity with the given object type exists.

    Declaration
    bool Exists(Guid key, Guid objectType)
    Parameters
    Type Name Description
    Guid key

    The Key of the entity to find.

    Guid objectType

    The object type key of the entity.

    Returns
    Type Description
    bool

    True if an entity with the given key and object type exists.

    View Source

    Exists(int)

    Checks whether an entity with the specified identifier exists.

    Declaration
    bool Exists(int id)
    Parameters
    Type Name Description
    int id

    The identifier of the entity.

    Returns
    Type Description
    bool

    true if the entity exists; otherwise, false.

    View Source

    Exists(int, Guid)

    Asserts if an entity with the given object type exists.

    Declaration
    bool Exists(int id, Guid objectType)
    Parameters
    Type Name Description
    int id

    The id of the entity to find.

    Guid objectType

    The object type key of the entity.

    Returns
    Type Description
    bool

    True if an entity with the given id and object type exists.

    View Source

    Get(Guid)

    Gets an entity by its unique key.

    Declaration
    IEntitySlim? Get(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique key of the entity.

    Returns
    Type Description
    IEntitySlim

    The entity if found; otherwise, null.

    View Source

    Get(Guid, Guid)

    Gets an entity by its unique key and object type.

    Declaration
    IEntitySlim? Get(Guid key, Guid objectTypeId)
    Parameters
    Type Name Description
    Guid key

    The unique key of the entity.

    Guid objectTypeId

    The object type identifier.

    Returns
    Type Description
    IEntitySlim

    The entity if found; otherwise, null.

    View Source

    Get(int)

    Gets an entity by its identifier.

    Declaration
    IEntitySlim? Get(int id)
    Parameters
    Type Name Description
    int id

    The identifier of the entity.

    Returns
    Type Description
    IEntitySlim

    The entity if found; otherwise, null.

    View Source

    Get(int, Guid)

    Gets an entity by its identifier and object type.

    Declaration
    IEntitySlim? Get(int id, Guid objectTypeId)
    Parameters
    Type Name Description
    int id

    The identifier of the entity.

    Guid objectTypeId

    The object type identifier.

    Returns
    Type Description
    IEntitySlim

    The entity if found; otherwise, null.

    View Source

    GetAll(Guid, params Guid[])

    Gets all entities of a specific object type by their unique keys.

    Declaration
    IEnumerable<IEntitySlim> GetAll(Guid objectType, params Guid[] keys)
    Parameters
    Type Name Description
    Guid objectType

    The object type identifier.

    Guid[] keys

    The unique keys of the entities.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    A collection of entities.

    View Source

    GetAll(Guid, params int[])

    Gets all entities of a specific object type by their identifiers.

    Declaration
    IEnumerable<IEntitySlim> GetAll(Guid objectType, params int[] ids)
    Parameters
    Type Name Description
    Guid objectType

    The object type identifier.

    int[] ids

    The identifiers of the entities.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    A collection of entities.

    View Source

    GetAllPaths(Guid, params Guid[])

    Gets all entity paths for a specific object type.

    Declaration
    IEnumerable<TreeEntityPath> GetAllPaths(Guid objectType, params Guid[] keys)
    Parameters
    Type Name Description
    Guid objectType

    The object type identifier.

    Guid[] keys

    The unique keys to filter the results.

    Returns
    Type Description
    IEnumerable<TreeEntityPath>

    A collection of entity paths.

    View Source

    GetAllPaths(Guid, params int[]?)

    Gets all entity paths for a specific object type.

    Declaration
    IEnumerable<TreeEntityPath> GetAllPaths(Guid objectType, params int[]? ids)
    Parameters
    Type Name Description
    Guid objectType

    The object type identifier.

    int[] ids

    Optional identifiers to filter the results.

    Returns
    Type Description
    IEnumerable<TreeEntityPath>

    A collection of entity paths.

    View Source

    GetByQuery(IQuery<IUmbracoEntity>)

    Gets entities for a query.

    Declaration
    IEnumerable<IEntitySlim> GetByQuery(IQuery<IUmbracoEntity> query)
    Parameters
    Type Name Description
    IQuery<IUmbracoEntity> query

    The query to apply.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    A collection of entities matching the query.

    View Source

    GetByQuery(IQuery<IUmbracoEntity>, Guid)

    Gets entities for a query and a specific object type, allowing the query to be slightly more optimized.

    Declaration
    IEnumerable<IEntitySlim> GetByQuery(IQuery<IUmbracoEntity> query, Guid objectType)
    Parameters
    Type Name Description
    IQuery<IUmbracoEntity> query

    The query to apply.

    Guid objectType

    The object type identifier.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    A collection of entities matching the query.

    View Source

    GetObjectType(Guid)

    Gets the object type for an entity by its unique key.

    Declaration
    UmbracoObjectTypes GetObjectType(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique key of the entity.

    Returns
    Type Description
    UmbracoObjectTypes

    The object type of the entity.

    View Source

    GetObjectType(int)

    Gets the object type for an entity by its identifier.

    Declaration
    UmbracoObjectTypes GetObjectType(int id)
    Parameters
    Type Name Description
    int id

    The identifier of the entity.

    Returns
    Type Description
    UmbracoObjectTypes

    The object type of the entity.

    View Source

    GetPagedResultsByQuery(IQuery<IUmbracoEntity>, ISet<Guid>, long, int, out long, IQuery<IUmbracoEntity>?, Ordering?)

    Gets paged entities for a query and multiple object types.

    Declaration
    IEnumerable<IEntitySlim> GetPagedResultsByQuery(IQuery<IUmbracoEntity> query, ISet<Guid> objectTypes, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity>? filter, Ordering? ordering)
    Parameters
    Type Name Description
    IQuery<IUmbracoEntity> query

    The query to apply.

    ISet<Guid> objectTypes

    The object type identifiers.

    long pageIndex

    The page index.

    int pageSize

    The page size.

    long totalRecords

    Returns the total number of records.

    IQuery<IUmbracoEntity> filter

    An optional filter query.

    Ordering ordering

    The ordering to apply, or null for default ordering.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    A collection of entities for the specified page.

    View Source

    GetPagedResultsByQuery(IQuery<IUmbracoEntity>, Guid, long, int, out long, IQuery<IUmbracoEntity>?, Ordering?)

    Gets paged entities for a query and a specific object type.

    Declaration
    IEnumerable<IEntitySlim> GetPagedResultsByQuery(IQuery<IUmbracoEntity> query, Guid objectType, long pageIndex, int pageSize, out long totalRecords, IQuery<IUmbracoEntity>? filter, Ordering? ordering)
    Parameters
    Type Name Description
    IQuery<IUmbracoEntity> query

    The query to apply.

    Guid objectType

    The object type identifier.

    long pageIndex

    The page index.

    int pageSize

    The page size.

    long totalRecords

    Returns the total number of records.

    IQuery<IUmbracoEntity> filter

    An optional filter query.

    Ordering ordering

    The ordering to apply, or null for default ordering.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    A collection of entities for the specified page.

    View Source

    GetSiblings(ISet<Guid>, Guid, int, int, IQuery<IUmbracoEntity>?, Ordering, out long, out long)

    Gets sibling entities of a specified target entity, within a given range before and after the target, ordered as specified.

    Declaration
    IEnumerable<IEntitySlim> GetSiblings(ISet<Guid> objectTypes, Guid targetKey, int before, int after, IQuery<IUmbracoEntity>? filter, Ordering ordering, out long totalBefore, out long totalAfter)
    Parameters
    Type Name Description
    ISet<Guid> objectTypes

    The object type keys of the entities.

    Guid targetKey

    The key of the target entity whose siblings are to be retrieved.

    int before

    The number of siblings to retrieve before the target entity.

    int after

    The number of siblings to retrieve after the target entity.

    IQuery<IUmbracoEntity> filter

    An optional filter to apply to the result set.

    Ordering ordering

    The ordering to apply to the siblings.

    long totalBefore

    Outputs the total number of siblings before the target entity.

    long totalAfter

    Outputs the total number of siblings after the target entity.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    Enumerable of sibling entities.

    View Source

    GetTrashedSiblings(ISet<Guid>, Guid, int, int, IQuery<IUmbracoEntity>?, Ordering, out long, out long)

    Gets trashed sibling entities of a specified target entity, within a given range before and after the target, ordered as specified.

    Declaration
    IEnumerable<IEntitySlim> GetTrashedSiblings(ISet<Guid> objectTypes, Guid targetKey, int before, int after, IQuery<IUmbracoEntity>? filter, Ordering ordering, out long totalBefore, out long totalAfter)
    Parameters
    Type Name Description
    ISet<Guid> objectTypes

    The object type keys of the entities.

    Guid targetKey

    The key of the target entity whose siblings are to be retrieved.

    int before

    The number of siblings to retrieve before the target entity.

    int after

    The number of siblings to retrieve after the target entity.

    IQuery<IUmbracoEntity> filter

    An optional filter to apply to the result set.

    Ordering ordering

    The ordering to apply to the siblings.

    long totalBefore

    Outputs the total number of siblings before the target entity.

    long totalAfter

    Outputs the total number of siblings after the target entity.

    Returns
    Type Description
    IEnumerable<IEntitySlim>

    Enumerable of trashed sibling entities.

    View Source

    ReserveId(Guid)

    Reserves an identifier for a given unique key.

    Declaration
    int ReserveId(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique key to reserve an identifier for.

    Returns
    Type Description
    int

    The reserved identifier.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX