0
Siyeza created
Hi,
What is the recommended way for deternining the current Tenant for domain service operations that operate on tenant specific data? Should I rely on AbpSession being populated with current TenantId or should I explicitly specify the TenantId as a parameter in the domain service requests, and use CurrentUnitOfWork.SetTenantId()?
Thanks
2 Answer(s)
-
0
hi
You can use the following method to get TenantId
protected virtual int? GetCurrentTenantIdOrNull() { if (CurrentUnitOfWorkProvider?.Current != null) { return CurrentUnitOfWorkProvider.Current.GetTenantId(); } return AbpSession.TenantId; }
-
0
Thank you