Base solution for your next web application
Open Closed

Should I add IMustHaveTenant to both parent\child resources? #4554


User avatar
0
[email protected] created

When multi-tenancy is enabled, should I add IMustHaveTenant / TenantId in the parent and child resource?

For example, Category / Product case. Category has a TenantId, and Product is a child entity of a Category and cannot be alone.

Should I make the entity Product inhirets from IMustHaveTenant as well? or no need?

And if not, should I check in the service code whether the user has access to the sub resource everytime?


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

    Hi @Product,

    If you are not going to access Product entity directly without Cateagory, then you don't have to add IMustHaveTenant. This is the ideal usage.

    In case you need this in the future, you can easily implement IMustHaveTenant for the Product entity and update it's TenantId field using a simple migration script.