Class Repository<TType, TContext\>
Namespace: Common.Repositories
Assembly: Common.dll
Implementation of Common.Contracts.IRepository%601 with all generic methods to manipulate entities in database.
Type Parameters
TType
The entity type.
TContext
The context type.
Inheritance
object ← Repository<TType, TContext\>
Implements
Inherited Members
object.Equals\(object?\), object.Equals\(object?, object?\), object.GetHashCode\(\), object.GetType\(\), object.MemberwiseClone\(\), object.ReferenceEquals\(object?, object?\), object.ToString\(\)
Constructors
Repository\(TContext\)
Implementation of Common.Contracts.IRepository%601 with all generic methods to manipulate entities in database.
Parameters
context TContext
Fields
Context
Field Value
TContext
Methods
Add\(TType\)
Method that add an entity of type T in the database.
Parameters
entity TType
Returns
TType
The added entity.
Delete\(TType\)
Method that remove an entity of type T from the database.
Parameters
entity TType
DeleteRange\(IEnumerable<TType\>\)
Method that remove all passed entities of type T from the database.
Parameters
entities IEnumerable <TType\>
Exists\(Func<TType, bool\>\)
Method that check if entity of type T in the database responds to a certain predicate.
Parameters
Returns
True if the entities in database respond to the given predicate, false otherwise.
GetAllAsync\(\)
Method that get all entities of type T in the database.
Returns
Task < IEnumerable <TType\>\>
System.Collections.Generic.IEnumerable%601 that contains all the elements.
GetByIdAsync\(Guid\)
Method that get an entity of type T in the database by it's System.Guid.
Parameters
entityId Guid
Returns
Task <TType?\>
Remarks
This method doesn't include related entities.
GetByIdAsyncWithConcurrency\(Guid\)
Method that get an entity of type T in the database by it's System.Guid. Remove entity tracking that was previously stored in it.
Parameters
entityId Guid
Returns
Task <TType?\>
Remarks
This method doesn't include related entities.
Update\(TType\)
Method that update an entity of type T in the database.
Parameters
entity TType
UpdateRange\(IEnumerable<TType\>\)
Method that update an entity of type T in the database.
Parameters
entities IEnumerable <TType\>