Search Results for

    Show / Hide Table of Contents
    View Source

    Class EntityRepositoryBase<TId, TEntity>

    Provides a base class to all IEntity based repositories.

    Inheritance
    System.Object
    RepositoryBase
    Namespace: Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public abstract class EntityRepositoryBase<TId, TEntity> : RepositoryBase, IReadWriteQueryRepository<TId, TEntity>, IReadRepository<TId, TEntity>, IWriteRepository<TEntity>, IQueryRepository<TEntity>, IRepository where TEntity : class, IEntity
    Type Parameters
    Name Description
    TId

    The type of the entity's unique identifier.

    TEntity

    The type of the entity managed by this repository.

    Constructors

    View Source

    EntityRepositoryBase(IScopeAccessor, AppCaches, ILogger<EntityRepositoryBase<TId, TEntity>>)

    Initializes a new instance of the EntityRepositoryBase<TId, TEntity> class.

    Declaration
    protected EntityRepositoryBase(IScopeAccessor scopeAccessor, AppCaches appCaches, ILogger<EntityRepositoryBase<TId, TEntity>> logger)
    Parameters
    Type Name Description
    IScopeAccessor scopeAccessor
    AppCaches appCaches
    ILogger<EntityRepositoryBase<TId, TEntity>> logger

    Properties

    View Source

    CachePolicy

    Gets the repository cache policy

    Declaration
    protected IRepositoryCachePolicy<TEntity, TId> CachePolicy { get; }
    Property Value
    Type Description
    IRepositoryCachePolicy<TEntity, TId>
    View Source

    DefaultOptions

    Gets the default RepositoryCachePolicyOptions

    Declaration
    protected virtual RepositoryCachePolicyOptions DefaultOptions { get; }
    Property Value
    Type Description
    RepositoryCachePolicyOptions
    View Source

    GlobalIsolatedCache

    Gets the isolated cache for the TEntity

    Declaration
    protected IAppPolicyCache GlobalIsolatedCache { get; }
    Property Value
    Type Description
    IAppPolicyCache
    View Source

    IsolatedCache

    Gets the isolated cache.

    Declaration
    protected IAppPolicyCache IsolatedCache { get; }
    Property Value
    Type Description
    IAppPolicyCache
    Remarks

    Depends on the ambient scope cache mode.

    View Source

    Logger

    Gets the logger

    Declaration
    protected ILogger<EntityRepositoryBase<TId, TEntity>> Logger { get; }
    Property Value
    Type Description
    ILogger<EntityRepositoryBase<TId, TEntity>>

    Methods

    View Source

    Count(IQuery<TEntity>)

    Returns an integer with the count of entities found with the passed in query

    Declaration
    public int Count(IQuery<TEntity> query)
    Parameters
    Type Name Description
    IQuery<TEntity> query
    Returns
    Type Description
    System.Int32
    View Source

    CreateCachePolicy()

    Create the repository cache policy

    Declaration
    protected virtual IRepositoryCachePolicy<TEntity, TId> CreateCachePolicy()
    Returns
    Type Description
    IRepositoryCachePolicy<TEntity, TId>
    View Source

    Delete(TEntity)

    Deletes the passed in entity

    Declaration
    public virtual void Delete(TEntity entity)
    Parameters
    Type Name Description
    TEntity entity
    View Source

    Exists(TId)

    Returns a boolean indicating whether an entity with the passed Id exists

    Declaration
    public bool Exists(TId id)
    Parameters
    Type Name Description
    TId id
    Returns
    Type Description
    System.Boolean
    View Source

    Get(TId)

    Gets an entity by the passed in Id utilizing the repository's cache policy

    Declaration
    public TEntity Get(TId id)
    Parameters
    Type Name Description
    TId id
    Returns
    Type Description
    TEntity
    View Source

    Get(IQuery<TEntity>)

    Gets a list of entities by the passed in query

    Declaration
    public IEnumerable<TEntity> Get(IQuery<TEntity> query)
    Parameters
    Type Name Description
    IQuery<TEntity> query
    Returns
    Type Description
    IEnumerable<TEntity>
    View Source

    GetBaseQuery(Boolean)

    Declaration
    protected abstract Sql<ISqlContext> GetBaseQuery(bool isCount)
    Parameters
    Type Name Description
    System.Boolean isCount
    Returns
    Type Description
    Sql<ISqlContext>
    View Source

    GetBaseWhereClause()

    Declaration
    protected abstract string GetBaseWhereClause()
    Returns
    Type Description
    System.String
    View Source

    GetDeleteClauses()

    Declaration
    protected abstract IEnumerable<string> GetDeleteClauses()
    Returns
    Type Description
    IEnumerable<System.String>
    View Source

    GetEntityId(TEntity)

    Get the entity id for the TEntity.

    Declaration
    protected virtual TId GetEntityId(TEntity entity)
    Parameters
    Type Name Description
    TEntity entity
    Returns
    Type Description
    TId
    View Source

    GetMany(TId[])

    Gets all entities of type TEntity or a list according to the passed in Ids

    Declaration
    public IEnumerable<TEntity> GetMany(params TId[] ids)
    Parameters
    Type Name Description
    TId[] ids
    Returns
    Type Description
    IEnumerable<TEntity>
    View Source

    PerformCount(IQuery<TEntity>)

    Declaration
    protected virtual int PerformCount(IQuery<TEntity> query)
    Parameters
    Type Name Description
    IQuery<TEntity> query
    Returns
    Type Description
    System.Int32
    View Source

    PerformExists(TId)

    Declaration
    protected virtual bool PerformExists(TId id)
    Parameters
    Type Name Description
    TId id
    Returns
    Type Description
    System.Boolean
    View Source

    PerformGet(TId)

    Declaration
    protected abstract TEntity PerformGet(TId id)
    Parameters
    Type Name Description
    TId id
    Returns
    Type Description
    TEntity
    View Source

    PerformGetAll(TId[])

    Declaration
    protected abstract IEnumerable<TEntity> PerformGetAll(params TId[] ids)
    Parameters
    Type Name Description
    TId[] ids
    Returns
    Type Description
    IEnumerable<TEntity>
    View Source

    PerformGetByQuery(IQuery<TEntity>)

    Declaration
    protected abstract IEnumerable<TEntity> PerformGetByQuery(IQuery<TEntity> query)
    Parameters
    Type Name Description
    IQuery<TEntity> query
    Returns
    Type Description
    IEnumerable<TEntity>
    View Source

    PersistDeletedItem(TEntity)

    Declaration
    protected virtual void PersistDeletedItem(TEntity entity)
    Parameters
    Type Name Description
    TEntity entity
    View Source

    PersistNewItem(TEntity)

    Declaration
    protected abstract void PersistNewItem(TEntity item)
    Parameters
    Type Name Description
    TEntity item
    View Source

    PersistUpdatedItem(TEntity)

    Declaration
    protected abstract void PersistUpdatedItem(TEntity item)
    Parameters
    Type Name Description
    TEntity item
    View Source

    Save(TEntity)

    Adds or Updates an entity of type TEntity

    Declaration
    public virtual void Save(TEntity entity)
    Parameters
    Type Name Description
    TEntity entity
    Remarks

    This method is backed by an IAppPolicyCache cache

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • EntityRepositoryBase(IScopeAccessor, AppCaches, ILogger<EntityRepositoryBase<TId, TEntity>>)
    • Properties
      • CachePolicy
      • DefaultOptions
      • GlobalIsolatedCache
      • IsolatedCache
      • Logger
    • Methods
      • Count(IQuery<TEntity>)
      • CreateCachePolicy()
      • Delete(TEntity)
      • Exists(TId)
      • Get(TId)
      • Get(IQuery<TEntity>)
      • GetBaseQuery(Boolean)
      • GetBaseWhereClause()
      • GetDeleteClauses()
      • GetEntityId(TEntity)
      • GetMany(TId[])
      • PerformCount(IQuery<TEntity>)
      • PerformExists(TId)
      • PerformGet(TId)
      • PerformGetAll(TId[])
      • PerformGetByQuery(IQuery<TEntity>)
      • PersistDeletedItem(TEntity)
      • PersistNewItem(TEntity)
      • PersistUpdatedItem(TEntity)
      • Save(TEntity)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX