Show / Hide Table of Contents

    Class GenericReadOnlyRepository<TEntity>

    Class that represents a read-only repository for an entity in the context.

    Inheritance
    System.Object
    GenericReadOnlyRepository<TEntity>
    GenericRepository<TEntity>
    Implements
    IReadOnlyRepository<TEntity>
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Fibula.Data.Repositories
    Assembly: Fibula.Data.dll
    Syntax
    public abstract class GenericReadOnlyRepository<TEntity> : IReadOnlyRepository<TEntity> where TEntity : BaseEntity
    Type Parameters
    Name Description
    TEntity

    The type of entity.

    Constructors

    | Improve this Doc View Source

    GenericReadOnlyRepository(DbContext)

    Initializes a new instance of the GenericReadOnlyRepository<TEntity> class.

    Declaration
    public GenericReadOnlyRepository(DbContext context)
    Parameters
    Type Name Description
    Microsoft.EntityFrameworkCore.DbContext context

    The context to use with this repository.

    Properties

    | Improve this Doc View Source

    Context

    Gets the reference to the context.

    Declaration
    protected DbContext Context { get; }
    Property Value
    Type Description
    Microsoft.EntityFrameworkCore.DbContext

    Methods

    | Improve this Doc View Source

    FindMany(Expression<Func<TEntity, Boolean>>)

    Finds all the entities in the set within the context that satisfy an expression.

    Declaration
    public IEnumerable<TEntity> FindMany(Expression<Func<TEntity, bool>> predicate)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<TEntity, System.Boolean>> predicate

    The expression to satisfy.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<TEntity>

    The collection of entities retrieved.

    | Improve this Doc View Source

    FindOne(Expression<Func<TEntity, Boolean>>)

    Finds an entity in the set within the context that satisfies an expression. If more than one entity satisfies the expression, one is picked up in an unknown criteria.

    Declaration
    public TEntity FindOne(Expression<Func<TEntity, bool>> predicate)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<TEntity, System.Boolean>> predicate

    The expression to satisfy.

    Returns
    Type Description
    TEntity

    The entity found.

    | Improve this Doc View Source

    GetAll()

    Gets all the entities from the set in the context.

    Declaration
    public IEnumerable<TEntity> GetAll()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<TEntity>

    The collection of entities retrieved.

    | Improve this Doc View Source

    GetById(String)

    Gets an entity that matches an id, from the context.

    Declaration
    public TEntity GetById(string id)
    Parameters
    Type Name Description
    System.String id

    The id to match.

    Returns
    Type Description
    TEntity

    The entity found, if any.

    Implements

    IReadOnlyRepository<TEntity>

    Extension Methods

    ObjectExtensions.YieldSingleItem<T>(T)
    ObjectExtensions.GetPropertyValue(Object, String)
    Validate.ThrowIfNull(Object, String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.