Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

IRepository.cs

using System.Linq.Expressions;
using Nop.Core;
using Nop.Core.Caching;

namespace Nop.Data;

/// 
/// Represents an entity repository
/// 
/// Entity type
public partial interface IRepository where TEntity : BaseEntity
{
    #region Methods

    /// 
    /// Get the entity entry
    /// 
    /// Entity entry identifier
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// Whether to use short term cache instead of static cache
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the entity entry
    /// 
    Task GetByIdAsync(int? id, Func getCacheKey = null, bool includeDeleted = true, bool useShortTermCache = false);

    /// 
    /// Get the entity entry
    /// 
    /// Entity entry identifier
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// The entity entry
    /// 
    TEntity GetById(int? id, Func getCacheKey = null, bool includeDeleted = true);

    /// 
    /// Get entity entries by identifiers
    /// 
    /// Entity entry identifiers
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the entity entries
    /// 
    Task> GetByIdsAsync(IList ids, Func getCacheKey = null, bool includeDeleted = true);

    /// 
    /// Get all entity entries
    /// 
    /// Function to select entries
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the entity entries
    /// 
    Task> GetAllAsync(Func, IQueryable> func = null,
        Func getCacheKey = null, bool includeDeleted = true);

    /// 
    /// Get all entity entries
    /// 
    /// Function to select entries
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the entity entries
    /// 
    Task> GetAllAsync(Func, Task>> func = null,
        Func getCacheKey = null, bool includeDeleted = true);

    /// 
    /// Get all entity entries
    /// 
    /// Function to select entries
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// Entity entries
    IList GetAll(Func, IQueryable> func = null,
        Func getCacheKey = null, bool includeDeleted = true);

    /// 
    /// Get all entity entries
    /// 
    /// Function to select entries
    /// Function to get a cache key; pass null to don't cache; return null from this function to use the default key
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the entity entries
    /// 
    Task> GetAllAsync(Func, Task>> func,
        Func> getCacheKey, bool includeDeleted = true);

    /// 
    /// Get all entity entries
    /// 
    /// Function to select entries
    /// Page index
    /// Page size
    /// Whether to get only the total number of entries without actually loading data
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the paged list of entity entries
    /// 
    Task> GetAllPagedAsync(Func, IQueryable> func = null,
        int pageIndex = 0, int pageSize = int.MaxValue, bool getOnlyTotalCount = false, bool includeDeleted = true);

    /// 
    /// Get all entity entries
    /// 
    /// Function to select entries
    /// Page index
    /// Page size
    /// Whether to get only the total number of entries without actually loading data
    /// Whether to include deleted items (applies only to  entities)
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the paged list of entity entries
    /// 
    Task> GetAllPagedAsync(Func, Task>> func = null,
        int pageIndex = 0, int pageSize = int.MaxValue, bool getOnlyTotalCount = false, bool includeDeleted = true);

    /// 
    /// Insert the entity entry
    /// 
    /// Entity entry
    /// Whether to publish event notification
    /// A task that represents the asynchronous operation
    Task InsertAsync(TEntity entity, bool publishEvent = true);

    /// 
    /// Insert the entity entry
    /// 
    /// Entity entry
    /// Whether to publish event notification
    void Insert(TEntity entity, bool publishEvent = true);

    /// 
    /// Insert entity entries
    /// 
    /// Entity entries
    /// Whether to publish event notification
    /// A task that represents the asynchronous operation
    Task InsertAsync(IList entities, bool publishEvent = true);

    /// 
    /// Insert entity entries
    /// 
    /// Entity entries
    /// Whether to publish event notification
    void Insert(IList entities, bool publishEvent = true);

    /// 
    /// Update the entity entry
    /// 
    /// Entity entry
    /// Whether to publish event notification
    /// A task that represents the asynchronous operation
    Task UpdateAsync(TEntity entity, bool publishEvent = true);

    /// 
    /// Update the entity entry
    /// 
    /// Entity entry
    /// Whether to publish event notification
    void Update(TEntity entity, bool publishEvent = true);

    /// 
    /// Update entity entries
    /// 
    /// Entity entries
    /// Whether to publish event notification
    /// A task that represents the asynchronous operation
    Task UpdateAsync(IList entities, bool publishEvent = true);

    /// 
    /// Update entity entries
    /// 
    /// Entity entries
    /// Whether to publish event notification
    void Update(IList entities, bool publishEvent = true);

    /// 
    /// Delete the entity entry
    /// 
    /// Entity entry
    /// Whether to publish event notification
    /// A task that represents the asynchronous operation
    Task DeleteAsync(TEntity entity, bool publishEvent = true);

    /// 
    /// Delete the entity entry
    /// 
    /// Entity entry
    /// Whether to publish event notification
    void Delete(TEntity entity, bool publishEvent = true);

    /// 
    /// Delete entity entries
    /// 
    /// Entity entries
    /// Whether to publish event notification
    /// A task that represents the asynchronous operation
    Task DeleteAsync(IList entities, bool publishEvent = true);

    /// 
    /// Delete entity entries by the passed predicate
    /// 
    /// A function to test each element for a condition
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the number of deleted records
    /// 
    Task DeleteAsync(Expression> predicate);

    /// 
    /// Delete entity entries by the passed predicate
    /// 
    /// A function to test each element for a condition
    /// 
    /// The number of deleted records
    /// 
    int Delete(Expression> predicate);

    /// 
    /// Loads the original copy of the entity entry
    /// 
    /// Entity entry
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the copy of the passed entity entry
    /// 
    Task LoadOriginalCopyAsync(TEntity entity);

    /// 
    /// Truncates database table
    /// 
    /// Performs reset identity column
    /// A task that represents the asynchronous operation
    Task TruncateAsync(bool resetIdentity = false);

    #endregion

    #region Properties

    /// 
    /// Gets a table
    /// 
    IQueryable Table { get; }

    #endregion
}