I have a MVC application which is multi tenant architecture. In this, there are some global variables (common to all users of every tenant) and some are specific to the logged in user. Also, there are some settings which are common to all users of a specific tenant.
I am storing and retrieving the Global and Session variables as mentioned below.
HttpContext.Current.Session["sessionVariableName]
. These variables loaded at the time login of a user. HttpContext.Current.Application["applicationVariableName"]
. These variables loaded in Global.asax on application startup. Now I have a question, how load the tenant specific variables. In which event I need load the vaiables? I do not want to load all the tenant specific variables at the time of application startup as many tenant may not be using the application. Also, it may be overhead at the time login of each user to check and load the tenant specific settings. What is the best approach ?
In your case, I would like to suggest the following approach
Database Entity Details for
1. TenantSettings The following can be the columns for TenantSettings
- TenantId
- SettingId
- SettingValue
- AuditFields like CreatedBy, CreatedOn, IsActive, UpdatedBy...
2. UserSettings
- UserId
- TenantId
- SettingId
- SettingValue
- Audit fields similar to the above
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.