From fa56017647748e502b2524fc57f59d1a026f8424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 7 Oct 2019 18:14:38 +0300 Subject: [PATCH] Resolved #362: AbpDbContext should handle nulls for all optional (property-injected) dependencies. --- .../Volo/Abp/EntityFrameworkCore/AbpDbContext.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index 3604913301..3d4b45d75d 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -30,9 +30,9 @@ namespace Volo.Abp.EntityFrameworkCore { protected virtual Guid? CurrentTenantId => CurrentTenant?.Id; - protected virtual bool IsMultiTenantFilterEnabled => DataFilter.IsEnabled(); + protected virtual bool IsMultiTenantFilterEnabled => DataFilter?.IsEnabled() ?? false; - protected virtual bool IsSoftDeleteFilterEnabled => DataFilter.IsEnabled(); + protected virtual bool IsSoftDeleteFilterEnabled => DataFilter?.IsEnabled() ?? false; public ICurrentTenant CurrentTenant { get; set; } @@ -316,17 +316,17 @@ namespace Volo.Abp.EntityFrameworkCore protected virtual void SetCreationAuditProperties(EntityEntry entry) { - AuditPropertySetter.SetCreationProperties(entry.Entity); + AuditPropertySetter?.SetCreationProperties(entry.Entity); } protected virtual void SetModificationAuditProperties(EntityEntry entry) { - AuditPropertySetter.SetModificationProperties(entry.Entity); + AuditPropertySetter?.SetModificationProperties(entry.Entity); } protected virtual void SetDeletionAuditProperties(EntityEntry entry) { - AuditPropertySetter.SetDeletionProperties(entry.Entity); + AuditPropertySetter?.SetDeletionProperties(entry.Entity); } protected virtual void ConfigureBaseProperties(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType)