多个客户端的单个实例 [英] Single instance for multiple clients

查看:77
本文介绍了多个客户端的单个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,
Already we have application using Asp.net with MVC and Sql server.
we would like to use single instance for multiple clients.
Please assist us which is the best way to handle this.At present we don't have any clear idea on it.
What about multi-tenants concept?Is this correct solution?
Thanks
Sella

推荐答案

是的,有。让每个用户拥有自己的ID和相关的ClientID。在所有表中将此ClientID用作主键的一个字段。无论你选择什么,都可以将ClientID作为选择器和任何其他参数一起发送。



例如:

用户1:Adam Smith,客户1

用户2:Ana Annis,客户1

用户3:John Adams,客户2

用户4:Smith Jones,客户3



当他们登录时,你会返回他们的客户编号(我建议使用带有整数主键的Clients表以便于转移)



拥有用户数据(比如说产品)

ProductId主键

Yes, there is. Have each user its own ID and related ClientID. Use this ClientID in all tables as one field of primary key. Wherever you select anything, send ClientID as selector along with any other parameters.

Example:
User 1 : Adam Smith, Client 1
User 2: Ana Annis, Client 1
User 3: John Adams, Client 2
User 4: Smith Jones, Client 3

When they login, you return their client number (I suggest having Clients table with integer primary key for ease of transfer)

Have user data (lets say Products) with
ProductId primary key
Product Code  -\
                \ These two are really compound primary key, should be unique index
                / You select products based on client id
Client Id     -/





请注意,除非您采取额外的预防措施,否则一个客户要求的任何更改都将反映给所有其他客户。它还会使备份复杂化,增加丢失所有客户数据的风险,以防数据库发生灾难性故障,增加服务器负载等......




更好的解决方案是获得单点访问权限,然后将用户重新路由到他们自己的站点(和数据库!!!)。更好的是,除非需要将所有数据都放在一个数据库中,否则将拥有完全独立的数据库。



Note that any changes requested by one client will be reflected to all other clients unless you take extra precautions. It also complicates backups, increases risk of loosing all your clients data in case of catastrophic failure of the database, increases load on your server etc...


Better solution is to have single point of access for admission that would then re-route users to their own site (and database!!!). Better yet would be to have totally separate databases with separate access unless there is a need for all data to be in one database.


这篇关于多个客户端的单个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆