通过sql server连接传递租户id
我正在使用 Microsoft SQL Server 构建具有共享表结构的多租户应用程序。
我想知道是否可以通过sql server 连接传递tenantID 参数。我不想为每个租户创建单独的用户帐户。
目前我看到两种方式:通过 ApplicationName 或 WorkstationID
最好的问候, 阿列克谢·扎哈罗夫
I'm building multi tenant application with shared table structure using Microsoft SQL Server.
I wonder if it possible to pass tenantID parameter via sql server connection. I don't want to create separate user account for each tenant.
Currently I see two ways: via ApplicationName or WorkstationID
Best regards,
Alexey Zakharov
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将使用 连接字符串的应用程序名称,然后使用 APP_NAME (Transact-SQL) 在 TSQL 中轻松获取。
不过,您也可以考虑使用CONTEXT_INFO (Transact-SQL)。
I would use the Application Name of the connect string, which is then easy to get at in TSQL with APP_NAME (Transact-SQL).
However, you could also consider using CONTEXT_INFO (Transact-SQL).