Show / Hide Table of Contents

Class AbpDbContext<TDbContext>

Inheritance
object
AbpDbContext<TDbContext>
AbpAuditingTestDbContext
FourthDbContext
SecondDbContext
ThirdDbContext
TestMigrationsDbContext
TestAppDbContext
Implements
IAbpEfCoreDbContext
IEfCoreDbContext
System.IDisposable
Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<><System.IServiceProvider>
Microsoft.EntityFrameworkCore.Internal.IDbContextDependencies
Microsoft.EntityFrameworkCore.Internal.IDbSetCache
Microsoft.EntityFrameworkCore.Internal.IDbContextPoolable
Microsoft.EntityFrameworkCore.Infrastructure.IResettableService
System.IAsyncDisposable
ITransientDependency
Namespace: Volo.Abp.EntityFrameworkCore
Assembly: Volo.Abp.EntityFrameworkCore.dll
Syntax
public abstract class AbpDbContext<TDbContext> : DbContext, IAbpEfCoreDbContext, IEfCoreDbContext, IDisposable, IInfrastructure<IServiceProvider>, IDbContextDependencies, IDbSetCache, IDbContextPoolable, IResettableService, IAsyncDisposable, ITransientDependency where TDbContext : DbContext
Type Parameters
Name Description
TDbContext

Constructors

AbpDbContext(DbContextOptions<TDbContext>)

Declaration
protected AbpDbContext(DbContextOptions<TDbContext> options)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.DbContextOptions<><TDbContext> options

Properties

AuditingManager

Declaration
public IAuditingManager AuditingManager { get; }
Property Value
Type Description
IAuditingManager

AuditPropertySetter

Declaration
public IAuditPropertySetter AuditPropertySetter { get; }
Property Value
Type Description
IAuditPropertySetter

Clock

Declaration
public IClock Clock { get; }
Property Value
Type Description
IClock

CurrentTenant

Declaration
public ICurrentTenant CurrentTenant { get; }
Property Value
Type Description
ICurrentTenant

CurrentTenantId

Declaration
protected virtual Guid? CurrentTenantId { get; }
Property Value
Type Description
System.Guid?

DataFilter

Declaration
public IDataFilter DataFilter { get; }
Property Value
Type Description
IDataFilter

DistributedEventBus

Declaration
public IDistributedEventBus DistributedEventBus { get; }
Property Value
Type Description
IDistributedEventBus

EntityChangeEventHelper

Declaration
public IEntityChangeEventHelper EntityChangeEventHelper { get; }
Property Value
Type Description
IEntityChangeEventHelper

EntityHistoryHelper

Declaration
public IEntityHistoryHelper EntityHistoryHelper { get; }
Property Value
Type Description
IEntityHistoryHelper

GuidGenerator

Declaration
public IGuidGenerator GuidGenerator { get; }
Property Value
Type Description
IGuidGenerator

IsMultiTenantFilterEnabled

Declaration
protected virtual bool IsMultiTenantFilterEnabled { get; }
Property Value
Type Description
bool

IsSoftDeleteFilterEnabled

Declaration
protected virtual bool IsSoftDeleteFilterEnabled { get; }
Property Value
Type Description
bool

LazyServiceProvider

Declaration
public IAbpLazyServiceProvider LazyServiceProvider { get; set; }
Property Value
Type Description
IAbpLazyServiceProvider

LocalEventBus

Declaration
public ILocalEventBus LocalEventBus { get; }
Property Value
Type Description
ILocalEventBus

Logger

Declaration
public ILogger<AbpDbContext<TDbContext>> Logger { get; }
Property Value
Type Description
Microsoft.Extensions.Logging.ILogger<TCategoryName><AbpDbContext<TDbContext>>

UnitOfWorkManager

Declaration
public IUnitOfWorkManager UnitOfWorkManager { get; }
Property Value
Type Description
IUnitOfWorkManager

Methods

ApplyAbpConceptsForAddedEntity(EntityEntry)

Declaration
protected virtual void ApplyAbpConceptsForAddedEntity(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

ApplyAbpConceptsForDeletedEntity(EntityEntry)

Declaration
protected virtual void ApplyAbpConceptsForDeletedEntity(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

ApplyAbpConceptsForModifiedEntity(EntityEntry)

Declaration
protected virtual void ApplyAbpConceptsForModifiedEntity(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

ChangeTracker_StateChanged(object, EntityStateChangedEventArgs)

Declaration
protected virtual void ChangeTracker_StateChanged(object sender, EntityStateChangedEventArgs e)
Parameters
Type Name Description
object sender
Microsoft.EntityFrameworkCore.ChangeTracking.EntityStateChangedEventArgs e

ChangeTracker_Tracked(object, EntityTrackedEventArgs)

Declaration
protected virtual void ChangeTracker_Tracked(object sender, EntityTrackedEventArgs e)
Parameters
Type Name Description
object sender
Microsoft.EntityFrameworkCore.ChangeTracking.EntityTrackedEventArgs e

CheckAndSetId(EntityEntry)

Declaration
protected virtual void CheckAndSetId(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

CombineExpressions<T>(Expression<Func<T, bool>>, Expression<Func<T, bool>>)

Declaration
protected virtual Expression<Func<T, bool>> CombineExpressions<T>(Expression<Func<T, bool>> expression1, Expression<Func<T, bool>> expression2)
Parameters
Type Name Description
System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><T, bool>> expression1
System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><T, bool>> expression2
Returns
Type Description
System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><T, bool>>
Type Parameters
Name Description
T

ConfigureBaseProperties<TEntity>(ModelBuilder, IMutableEntityType)

Declaration
protected virtual void ConfigureBaseProperties<TEntity>(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) where TEntity : class
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder
Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType mutableEntityType
Type Parameters
Name Description
TEntity

ConfigureGlobalFilters<TEntity>(ModelBuilder, IMutableEntityType)

Declaration
protected virtual void ConfigureGlobalFilters<TEntity>(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) where TEntity : class
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder
Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType mutableEntityType
Type Parameters
Name Description
TEntity

ConfigureValueConverter<TEntity>(ModelBuilder, IMutableEntityType)

Declaration
protected virtual void ConfigureValueConverter<TEntity>(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) where TEntity : class
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder
Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType mutableEntityType
Type Parameters
Name Description
TEntity

ConfigureValueGenerated<TEntity>(ModelBuilder, IMutableEntityType)

Declaration
protected virtual void ConfigureValueGenerated<TEntity>(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) where TEntity : class
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder
Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType mutableEntityType
Type Parameters
Name Description
TEntity

CreateEventReport()

Declaration
protected virtual EntityEventReport CreateEventReport()
Returns
Type Description
EntityEventReport

CreateFilterExpression<TEntity>()

Declaration
protected virtual Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>() where TEntity : class
Returns
Type Description
System.Linq.Expressions.Expression<TDelegate><System.Func<T, TResult><TEntity, bool>>
Type Parameters
Name Description
TEntity

FillExtraPropertiesForTrackedEntities(EntityTrackedEventArgs)

Declaration
protected virtual void FillExtraPropertiesForTrackedEntities(EntityTrackedEventArgs e)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityTrackedEventArgs e

GetDatabaseProviderOrNull(ModelBuilder)

Declaration
protected virtual EfCoreDatabaseProvider? GetDatabaseProviderOrNull(ModelBuilder modelBuilder)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder
Returns
Type Description
EfCoreDatabaseProvider?

HandleExtraPropertiesOnSave(EntityEntry)

Declaration
protected virtual void HandleExtraPropertiesOnSave(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

HandlePropertiesBeforeSave()

Declaration
protected virtual void HandlePropertiesBeforeSave()

Initialize(AbpEfCoreDbContextInitializationContext)

Declaration
public virtual void Initialize(AbpEfCoreDbContextInitializationContext initializationContext)
Parameters
Type Name Description
AbpEfCoreDbContextInitializationContext initializationContext

IsHardDeleted(EntityEntry)

Declaration
protected virtual bool IsHardDeleted(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry
Returns
Type Description
bool

OnModelCreating(ModelBuilder)

Declaration
protected override void OnModelCreating(ModelBuilder modelBuilder)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder

SaveChangesAsync(bool, CancellationToken)

Declaration
public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default)
Parameters
Type Name Description
bool acceptAllChangesOnSuccess
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TResult><int>

SaveChangesOnDbContextAsync(bool, CancellationToken)

Declaration
public virtual Task<int> SaveChangesOnDbContextAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default)
Parameters
Type Name Description
bool acceptAllChangesOnSuccess
System.Threading.CancellationToken cancellationToken
Returns
Type Description
System.Threading.Tasks.Task<TResult><int>

SetConcurrencyStampIfNull(EntityEntry)

Declaration
protected virtual void SetConcurrencyStampIfNull(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

SetCreationAuditProperties(EntityEntry)

Declaration
protected virtual void SetCreationAuditProperties(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

SetDeletionAuditProperties(EntityEntry)

Declaration
protected virtual void SetDeletionAuditProperties(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

SetModificationAuditProperties(EntityEntry)

Declaration
protected virtual void SetModificationAuditProperties(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

ShouldFilterEntity<TEntity>(IMutableEntityType)

Declaration
protected virtual bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType) where TEntity : class
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.Metadata.IMutableEntityType entityType
Returns
Type Description
bool
Type Parameters
Name Description
TEntity

TrySetDatabaseProvider(ModelBuilder)

Declaration
protected virtual void TrySetDatabaseProvider(ModelBuilder modelBuilder)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder

TrySetGuidId(EntityEntry, IEntity<Guid>)

Declaration
protected virtual void TrySetGuidId(EntityEntry entry, IEntity<Guid> entity)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry
IEntity<System.Guid> entity

UpdateConcurrencyStamp(EntityEntry)

Declaration
protected virtual void UpdateConcurrencyStamp(EntityEntry entry)
Parameters
Type Name Description
Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry entry

Implements

IAbpEfCoreDbContext
IEfCoreDbContext
System.IDisposable
Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<>
Microsoft.EntityFrameworkCore.Internal.IDbContextDependencies
Microsoft.EntityFrameworkCore.Internal.IDbSetCache
Microsoft.EntityFrameworkCore.Internal.IDbContextPoolable
Microsoft.EntityFrameworkCore.Infrastructure.IResettableService
System.IAsyncDisposable
ITransientDependency

Extension Methods

AbpObjectExtensions.As<T>(object)
AbpObjectExtensions.To<T>(object)
LockExtensions.Locking(object, Action)
LockExtensions.Locking<TResult>(object, Func<TResult>)
AbpObjectExtensions.If<T>(T, bool, Action<T>)
AbpObjectExtensions.If<T>(T, bool, Func<T, T>)
AbpObjectExtensions.IsIn<T>(T, IEnumerable<T>)
AbpObjectExtensions.IsIn<T>(T, params T[])
AbpQueryableExtensions.OrderByIf<T, TQueryable>(TQueryable, bool, string)
AbpQueryableExtensions.PageBy<T, TQueryable>(TQueryable, int, int)
AbpQueryableExtensions.WhereIf<T, TQueryable>(TQueryable, bool, Expression<Func<T, bool>>)
AbpQueryableExtensions.WhereIf<T, TQueryable>(TQueryable, bool, Expression<Func<T, int, bool>>)
LockExtensions.Locking<T>(T, Action<T>)
LockExtensions.Locking<T, TResult>(T, Func<T, TResult>)
In This Article
Back to top Powered by Volosoft