Base solution for your next web application
Open Closed

TenantId at insertion in multitenant app #102


User avatar
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.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    There is a waiting enhanchment (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/431">https://github.com/aspnetboilerplate/as ... issues/431</a>) 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.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)