Open Closed

TenantId at insertion in multitenant app #102


0
hozkar created

Hi!

When i am going to insert a record, i need to define its tenantId.

At this moment, what i am doing is to query AbpSession in my Service to obtain the TenantId of the user; then asign it to the record and save it with the aproppiate repository.

Is this the recommended approach?

Thanks in advance.


1 Answer(s)
  • 0
    hikalkan created

    Hi,

    There is a waiting enhanchment (https://github.com/aspnetboilerplate/as ... issues/431) that will set TenantId automatically ic certain cases. You should to set it now manually.

    Yes, it's suggested way you do. Set AbpSession.TenantId to entities which implements IMayHaveTenant or IMustHaveTenant.