Class GenericRepository<TEntity>
Class that represents a repository for any entity in the context.
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 GenericRepository<TEntity> : GenericReadOnlyRepository<TEntity>, IReadOnlyRepository<TEntity> where TEntity : BaseEntity
Type Parameters
Name | Description |
---|---|
TEntity | The type of entity. |
Constructors
| Improve this Doc View SourceGenericRepository(DbContext)
Initializes a new instance of the GenericRepository<TEntity> class.
Declaration
public GenericRepository(DbContext context)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.EntityFrameworkCore.DbContext | context | The context to use with this repository. |
Methods
| Improve this Doc View SourceAdd(TEntity)
Adds an entity to the set in the context.
Declaration
public void Add(TEntity entity)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to add. |
AddRange(IEnumerable<TEntity>)
Adds a range of entities to the set in the context.
Declaration
public void AddRange(IEnumerable<TEntity> entities)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEntity> | entities | The entity range to add. |
Remove(TEntity)
Removes an entity from the set in the context.
Declaration
public void Remove(TEntity entity)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to remove. |
RemoveRange(IEnumerable<TEntity>)
Removes a range of entities from the set in the context.
Declaration
public void RemoveRange(IEnumerable<TEntity> entities)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TEntity> | entities | The entity range to remove. |