Show / Hide Table of Contents

Class AbpDbContext<TDbContext>

Inheritance
System.Object
AbpDbContext<TDbContext>
AbpAuditLoggingDbContext
BackgroundJobsDbContext
BlobStoringDbContext
FeatureManagementDbContext
IdentityServerDbContext
PermissionManagementDbContext
SettingManagementDbContext
TenantManagementDbContext
BloggingDbContext
CmsKitDbContext
DocsDbContext
Implements
IAbpEfCoreDbContext
IEfCoreDbContext
IDisposable
IInfrastructure<IServiceProvider>
IDbContextDependencies
IDbSetCache
IDbContextPoolable
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, ITransientDependency where TDbContext : DbContext
Type Parameters
Name Description
TDbContext

Constructors

AbpDbContext(DbContextOptions<TDbContext>)

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

Properties

AuditingManager

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

AuditPropertySetter

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

Clock

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

CurrentTenant

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

CurrentTenantId

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

DataFilter

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

EntityChangeEventHelper

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

EntityHistoryHelper

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

GuidGenerator

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

IsMultiTenantFilterEnabled

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

IsSoftDeleteFilterEnabled

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

Logger

Declaration
public ILogger<AbpDbContext<TDbContext>> Logger { get; set; }
Property Value
Type Description
ILogger<AbpDbContext<TDbContext>>

UnitOfWorkManager

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

Methods

AddDomainEvents(EntityChangeReport, Object)

Declaration
protected virtual void AddDomainEvents(EntityChangeReport changeReport, object entityAsObj)
Parameters
Type Name Description
EntityChangeReport changeReport
System.Object entityAsObj

ApplyAbpConcepts()

Declaration
protected virtual EntityChangeReport ApplyAbpConcepts()
Returns
Type Description
EntityChangeReport

ApplyAbpConcepts(EntityEntry, EntityChangeReport)

Declaration
protected virtual void ApplyAbpConcepts(EntityEntry entry, EntityChangeReport changeReport)
Parameters
Type Name Description
EntityEntry entry
EntityChangeReport changeReport

ApplyAbpConceptsForAddedEntity(EntityEntry, EntityChangeReport)

Declaration
protected virtual void ApplyAbpConceptsForAddedEntity(EntityEntry entry, EntityChangeReport changeReport)
Parameters
Type Name Description
EntityEntry entry
EntityChangeReport changeReport

ApplyAbpConceptsForDeletedEntity(EntityEntry, EntityChangeReport)

Declaration
protected virtual void ApplyAbpConceptsForDeletedEntity(EntityEntry entry, EntityChangeReport changeReport)
Parameters
Type Name Description
EntityEntry entry
EntityChangeReport changeReport

ApplyAbpConceptsForModifiedEntity(EntityEntry, EntityChangeReport)

Declaration
protected virtual void ApplyAbpConceptsForModifiedEntity(EntityEntry entry, EntityChangeReport changeReport)
Parameters
Type Name Description
EntityEntry entry
EntityChangeReport changeReport

ChangeTracker_Tracked(Object, EntityTrackedEventArgs)

Declaration
protected virtual void ChangeTracker_Tracked(object sender, EntityTrackedEventArgs e)
Parameters
Type Name Description
System.Object sender
EntityTrackedEventArgs e

CheckAndSetId(EntityEntry)

Declaration
protected virtual void CheckAndSetId(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

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

Declaration
protected virtual Expression<Func<T, bool>> CombineExpressions<T>(Expression<Func<T, bool>> expression1, Expression<Func<T, bool>> expression2)
Parameters
Type Name Description
Expression<Func<T, System.Boolean>> expression1
Expression<Func<T, System.Boolean>> expression2
Returns
Type Description
Expression<Func<T, System.Boolean>>
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
ModelBuilder modelBuilder
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
ModelBuilder modelBuilder
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
ModelBuilder modelBuilder
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
ModelBuilder modelBuilder
IMutableEntityType mutableEntityType
Type Parameters
Name Description
TEntity

CreateFilterExpression<TEntity>()

Declaration
protected virtual Expression<Func<TEntity, bool>> CreateFilterExpression<TEntity>()

    where TEntity : class
Returns
Type Description
Expression<Func<TEntity, System.Boolean>>
Type Parameters
Name Description
TEntity

FillExtraPropertiesForTrackedEntities(EntityTrackedEventArgs)

Declaration
protected virtual void FillExtraPropertiesForTrackedEntities(EntityTrackedEventArgs e)
Parameters
Type Name Description
EntityTrackedEventArgs e

GetDatabaseProviderOrNull(ModelBuilder)

Declaration
protected virtual EfCoreDatabaseProvider? GetDatabaseProviderOrNull(ModelBuilder modelBuilder)
Parameters
Type Name Description
ModelBuilder modelBuilder
Returns
Type Description
System.Nullable<EfCoreDatabaseProvider>

HandleExtraPropertiesOnSave(EntityEntry)

Declaration
protected virtual void HandleExtraPropertiesOnSave(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

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
EntityEntry entry
Returns
Type Description
System.Boolean

OnModelCreating(ModelBuilder)

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

SaveChangesAsync(Boolean, CancellationToken)

Declaration
public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Boolean acceptAllChangesOnSuccess
CancellationToken cancellationToken
Returns
Type Description
Task<System.Int32>

SaveChangesOnDbContextAsync(Boolean, CancellationToken)

This method will call the DbContext SaveChangesAsync(Boolean, CancellationToken) method directly of EF Core, which doesn't apply concepts of abp.

Declaration
public virtual Task<int> SaveChangesOnDbContextAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = null)
Parameters
Type Name Description
System.Boolean acceptAllChangesOnSuccess
CancellationToken cancellationToken
Returns
Type Description
Task<System.Int32>

SetConcurrencyStampIfNull(EntityEntry)

Declaration
protected virtual void SetConcurrencyStampIfNull(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

SetCreationAuditProperties(EntityEntry)

Declaration
protected virtual void SetCreationAuditProperties(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

SetDeletionAuditProperties(EntityEntry)

Declaration
protected virtual void SetDeletionAuditProperties(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

SetModificationAuditProperties(EntityEntry)

Declaration
protected virtual void SetModificationAuditProperties(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

ShouldFilterEntity<TEntity>(IMutableEntityType)

Declaration
protected virtual bool ShouldFilterEntity<TEntity>(IMutableEntityType entityType)

    where TEntity : class
Parameters
Type Name Description
IMutableEntityType entityType
Returns
Type Description
System.Boolean
Type Parameters
Name Description
TEntity

TryCancelDeletionForSoftDelete(EntityEntry)

Declaration
protected virtual bool TryCancelDeletionForSoftDelete(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry
Returns
Type Description
System.Boolean

TrySetDatabaseProvider(ModelBuilder)

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

TrySetGuidId(EntityEntry, IEntity<Guid>)

Declaration
protected virtual void TrySetGuidId(EntityEntry entry, IEntity<Guid> entity)
Parameters
Type Name Description
EntityEntry entry
IEntity<Guid> entity

UpdateConcurrencyStamp(EntityEntry)

Declaration
protected virtual void UpdateConcurrencyStamp(EntityEntry entry)
Parameters
Type Name Description
EntityEntry entry

Implements

IAbpEfCoreDbContext
IEfCoreDbContext
IDisposable
IInfrastructure<>
IDbContextDependencies
IDbSetCache
IDbContextPoolable
ITransientDependency

Extension Methods

AbpObjectExtensions.As<T>(Object)
AbpObjectExtensions.To<T>(Object)
AbpObjectExtensions.IsIn<T>(T, T[])
AbpObjectExtensions.If<T>(T, Boolean, Func<T, T>)
AbpObjectExtensions.If<T>(T, Boolean, Action<T>)
LockExtensions.Locking(Object, Action)
LockExtensions.Locking<T>(T, Action<T>)
LockExtensions.Locking<TResult>(Object, Func<TResult>)
LockExtensions.Locking<T, TResult>(T, Func<T, TResult>)
Back to top Powered by Volosoft