From 1103ed2a266416c6640c9a56d5bf3118516af8b7 Mon Sep 17 00:00:00 2001 From: mehmetuken Date: Mon, 20 May 2019 10:38:58 +0300 Subject: [PATCH] Check entity has a tenant id value. --- .../Volo/Abp/Application/Services/CrudAppServiceBase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs index 638375524c..0e2efa2dd5 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppServiceBase.cs @@ -154,9 +154,14 @@ namespace Volo.Abp.Application.Services protected virtual void TryToSetTenantId(TEntity entity) { + if (entity is IMultiTenant tenantEntity && tenantEntity.TenantId.HasValue) + { + return; + } + var tenantId = CurrentTenant.Id; - if (tenantId == null) + if (!tenantId.HasValue) { return; }