Support forum for ASP.NET Zero (https://aspnetzero.com/).
By bytePlatz
#3118 Hello there,

I am using Abp for our NServiceBus Endpoint (Windows Service) and I need to configure the message handlers to work with multitenancy.

As far as I know, Abp uses AbpSession to retrieve TenantId for EntityFramework Dynamicfilter.

Since this service does not have logins, what would be the best way to deal with this when aI receive the message ?

1) Create my own implementation for IAbpSession and register it as transient (thus being created for every message received) ?

- Using this approach I can set TenantId and UserId into the session because the received message contains TenantId and UserId (headers). This way, EntityFramework dynamic filter will work transparently ?

2) Just set the PropertyFilter (EF DynamicFilter) values when the message arrives ? This way the DB-part of the multitenancy side is solved, but we may hit other issues with Session being null ?

Appreciate your suggestions

Bruno