Base solution for your next web application
Open Closed

Auto insert a foreign key like tenantId #5473


User avatar
0
agebmustafa created

Hey, I’m implementing a system with 4 modes and In front end I made option for users to choose which mode he/she are gonna working on inside the header components/ now all my entities should take the mode Id as foreign key so how can I make auto inserted to each new entity created and filtered when returning back exactly like tenants idea

Note that in mode table I created mode status column which is representing the only active mode of the 4 modes


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

    It seems that you are looking at something similar to MultiTenancy Data Filter

    See <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#data-filters">https://aspnetboilerplate.com/Pages/Doc ... ta-filters</a>

    However, for auto insertion of ModeId will require more work. For example, Mode selected by user might need to be stored in the Session as well as determining the Current Mode of user.

    See <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#session">https://aspnetboilerplate.com/Pages/Doc ... cy#session</a> And <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#determining-current-tenant">https://aspnetboilerplate.com/Pages/Doc ... ent-tenant</a>