RapidField logo
Solid Instruments logo

EntityFrameworkRepository<TEntity, TContext>

Performs data access operations against an Entity Framework entity type using a single transaction.

Inheritance
Object
Instrument
DataAccessRepository<TEntity>
EntityFrameworkRepository<TEntity, TContext>
Implements
IDataAccessRepository<TEntity>
IDataAccessRepository
IDisposable
Inherited Members
DataAccessRepository<TEntity>.Add(TEntity)
DataAccessRepository<TEntity>.AddOrUpdate(TEntity)
DataAccessRepository<TEntity>.AddOrUpdateRange(IEnumerable<TEntity>)
DataAccessRepository<TEntity>.AddRange(IEnumerable<TEntity>)
DataAccessRepository<TEntity>.All()
DataAccessRepository<TEntity>.Any()
DataAccessRepository<TEntity>.Contains(TEntity)
DataAccessRepository<TEntity>.ContainsWhere(Expression<Func<TEntity, Boolean>>)
DataAccessRepository<TEntity>.Count()
DataAccessRepository<TEntity>.CountWhere(Expression<Func<TEntity, Boolean>>)
DataAccessRepository<TEntity>.FindWhere(Expression<Func<TEntity, Boolean>>)
DataAccessRepository<TEntity>.Remove(TEntity)
DataAccessRepository<TEntity>.RemoveRange(IEnumerable<TEntity>)
DataAccessRepository<TEntity>.RemoveWhere(Expression<Func<TEntity, Boolean>>)
DataAccessRepository<TEntity>.Update(TEntity)
DataAccessRepository<TEntity>.UpdateRange(IEnumerable<TEntity>)
DataAccessRepository<TEntity>.EntityType
Instrument.Dispose()
Instrument.RejectIfDisposed()
Instrument.StateControl
Instrument.IsDisposed
Instrument.IsDisposedOrDisposing
Instrument.IsDisposing
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: RapidField.SolidInstruments.DataAccess.EntityFramework
Assembly: RapidField.SolidInstruments.DataAccess.EntityFramework.dll
Syntax (C#)
public class EntityFrameworkRepository<TEntity, TContext> : DataAccessRepository<TEntity>, IDataAccessRepository<TEntity>, IDataAccessRepository, IDisposable where TEntity : class where TContext : DbContext
Type Parameters
NameDescription
TEntity

The type of the entity.

TContext

The type of the database session for the repository.

Constructors

EntityFrameworkRepository(TContext)

Initializes a new instance of the EntityFrameworkRepository<TEntity, TContext> class.

Declaration (C#)
public EntityFrameworkRepository(TContext context)
Parameters
TypeNameDescription
TContextcontext

The database session for the repository.

Exceptions
TypeCondition
ArgumentNullException

context is null.

Methods

Add(TEntity, ConcurrencyControlToken)

Adds the specified entity to the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void Add(TEntity entity, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
TEntityentity

The entity to add.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.Add(TEntity, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

AddRange(IEnumerable<TEntity>, ConcurrencyControlToken)

Adds the specified entities to the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void AddRange(IEnumerable<TEntity> entities, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
IEnumerable<TEntity>entities

The entities to add.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.AddRange(System.Collections.Generic.IEnumerable<TEntity>, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

All(ConcurrencyControlToken)

Returns all entities from the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override IQueryable<TEntity> All(ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Returns
TypeDescription
IQueryable<TEntity>

All entities within the current EntityFrameworkRepository<TEntity, TContext>.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.All(RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

AnyWhere(Expression<Func<TEntity, Boolean>>, ConcurrencyControlToken)

Determines whether or not any entities matching the specified predicate exist in the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override bool AnyWhere(Expression<Func<TEntity, bool>> predicate, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
Expression<Func<TEntity, Boolean>>predicate

An expression to test each entity for a condition.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Returns
TypeDescription
Boolean

true if any entities matching the specified predicate exist in the current EntityFrameworkRepository<TEntity, TContext>, otherwise false.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.AnyWhere(System.Linq.Expressions.Expression<System.Func<TEntity, System.Boolean>>, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

Contains(TEntity, ConcurrencyControlToken)

Determines whether or not the specified entity exists in the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override bool Contains(TEntity entity, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
TEntityentity

The entity to evaluate.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Returns
TypeDescription
Boolean

true if the specified entity exists in the current EntityFrameworkRepository<TEntity, TContext>, otherwise false.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.Contains(TEntity, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

Count(ConcurrencyControlToken)

Returns the number of entities in the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override long Count(ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Returns
TypeDescription
Int64

The number of entities in the current EntityFrameworkRepository<TEntity, TContext>.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.Count(RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

CountWhere(Expression<Func<TEntity, Boolean>>, ConcurrencyControlToken)

Returns the number of entities matching the specified predicate in the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override long CountWhere(Expression<Func<TEntity, bool>> predicate, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
Expression<Func<TEntity, Boolean>>predicate

An expression to test each entity for a condition.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Returns
TypeDescription
Int64

The number of entities matching the specified predicate in the current EntityFrameworkRepository<TEntity, TContext>.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.CountWhere(System.Linq.Expressions.Expression<System.Func<TEntity, System.Boolean>>, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

Dispose(Boolean)

Releases all resources consumed by the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void Dispose(bool disposing)
Parameters
TypeNameDescription
Booleandisposing

A value indicating whether or not managed resources should be released.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.Dispose(System.Boolean)

FindWhere(Expression<Func<TEntity, Boolean>>, ConcurrencyControlToken)

Returns all entities matching the specified predicate from the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override IQueryable<TEntity> FindWhere(Expression<Func<TEntity, bool>> predicate, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
Expression<Func<TEntity, Boolean>>predicate

An expression to test each entity for a condition.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Returns
TypeDescription
IQueryable<TEntity>

All entities matching the specified predicate within the current EntityFrameworkRepository<TEntity, TContext>.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.FindWhere(System.Linq.Expressions.Expression<System.Func<TEntity, System.Boolean>>, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

Remove(TEntity, ConcurrencyControlToken)

Removes the specified entity from the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void Remove(TEntity entity, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
TEntityentity

The entity to remove.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.Remove(TEntity, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

RemoveRange(IEnumerable<TEntity>, ConcurrencyControlToken)

Removes the specified entities from the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void RemoveRange(IEnumerable<TEntity> entities, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
IEnumerable<TEntity>entities

The entities to remove.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.RemoveRange(System.Collections.Generic.IEnumerable<TEntity>, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

Update(TEntity, ConcurrencyControlToken)

Updates the specified entity in the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void Update(TEntity entity, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
TEntityentity

The entity to update.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.Update(TEntity, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

UpdateRange(IEnumerable<TEntity>, ConcurrencyControlToken)

Updates the specified entities in the current EntityFrameworkRepository<TEntity, TContext>.

Declaration (C#)
protected override void UpdateRange(IEnumerable<TEntity> entities, ConcurrencyControlToken controlToken)
Parameters
TypeNameDescription
IEnumerable<TEntity>entities

The entities to update.

ConcurrencyControlTokencontrolToken

A token that represents and manages contextual thread safety.

Overrides
RapidField.SolidInstruments.DataAccess.DataAccessRepository<TEntity>.UpdateRange(System.Collections.Generic.IEnumerable<TEntity>, RapidField.SolidInstruments.Core.Concurrency.ConcurrencyControlToken)

Implements

IDataAccessRepository<TEntity>
IDataAccessRepository
System.IDisposable

Extension Methods

ObjectExtensions.RejectIf<TArgument>(TArgument)
ObjectExtensions.RejectIf<TArgument>(TArgument, Predicate<TArgument>)
ObjectExtensions.RejectIf<TArgument>(TArgument, Predicate<TArgument>, String)
ObjectExtensions.RejectIf<TArgument>(TArgument, Predicate<TArgument>, String, String)
Back to top © 2019 RapidField