Show / Hide Table of Contents

Class SqlEntityFrameworkRepositoryBase<TEntity, TDbContext>

Base class implementation of the repository pattern for an EF Core entity data type stored in SQL Server. This provides standardized access to the DbContext and implements IDispoable.

Inheritance
object
SqlEntityFrameworkRepositoryBase<TEntity, TDbContext>
SqlEntityFrameworkCrudRepositoryBase<TEntity, TDbContext>
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.EfCore.SqlServer
Assembly: Benday.EfCore.SqlServer.dll
Syntax
public abstract class SqlEntityFrameworkRepositoryBase<TEntity, TDbContext> : IDisposable where TEntity : class, IEntityBase where TDbContext : DbContext
Type Parameters
Name Description
TEntity

Entity data type managed by this repository implementation. Must be an instance of IInt32Identity.

TDbContext

EF Core DbContext data type that manages this entity

Constructors

| Edit this page View Source

SqlEntityFrameworkRepositoryBase(TDbContext)

Declaration
protected SqlEntityFrameworkRepositoryBase(TDbContext context)
Parameters
Type Name Description
TDbContext context

Properties

| Edit this page View Source

Context

The instance of EF Core DbContext used by the repository.

Declaration
protected TDbContext Context { get; }
Property Value
Type Description
TDbContext

Methods

| Edit this page View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
| Edit this page View Source

Dispose(bool)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing
| Edit this page View Source

VerifyItemIsAddedOrAttachedToDbSet(DbSet<TEntity>, TEntity)

Verifies that an object is attached to the DbContext instance and attaches it if necessary.

Declaration
protected void VerifyItemIsAddedOrAttachedToDbSet(DbSet<TEntity> dbset, TEntity item)
Parameters
Type Name Description
DbSet<TEntity> dbset

DbSet instance that should contain this entity

TEntity item

Entity instance to verify is attached

Implements

IDisposable
  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com