best practice for DAL and configuration on Multi-Tenant isolated DB

微笑、不失礼 提交于 2019-12-08 20:48:46

问题


My company holds a dozen websites and isolated DBs (identical schemas). every customer has its own website (different app pool) and DB.

every website has its own configuration, several connection strings, but they all have same schema for configuration.

cust1.domain.com

cust2.domain.com

cust3.domain.com

We would like to merge all websites to one (single app pool) and stay with isolated DBs for security and large amount of data reasons.

what is the best practice for designing a DAL and configuration of it? what are the implications of it, if large amount of tenant will be on the same time? does one application pool can manage this situation or it can be managed somehow?

BTW, we are using asp-membership for users authentication.

Thanks in advance, Eddie


回答1:


Use Application_PostAuthenticate event in global.asax to load the correct database and then close the connection in Application_EndRequest




回答2:


One option is to use the profile in membership and store a piece of information that will allow you to determine which of the actual db's they should be connecting to. Downside is that you will need to store this piece of information for the duration of the users session so either a cookie or session variable is likley to be needed.

The implications of one site vs many depends a lot on your environment and application, do you currently have the multiple sites on a single box or do you have a web farm? do you know the number of concurrent users for each site, the amount of traffic? Performance monitor can help you here to see how busy each site is but you may need more invasive logging to determine metrics such as concurrent users. I found this server fault question around IIS 7 performance which may be of help




回答3:


You can try 'Shared DataBase With Different Schema' from multi tenant data architecture . In your DAL you can choose specific schema which perticular to current user. Simple and secure in this way

Continue reading http://msdn.microsoft.com/en-us/library/aa479086.aspx



来源:https://stackoverflow.com/questions/14230644/best-practice-for-dal-and-configuration-on-multi-tenant-isolated-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!