配置设置 来自多租户数据库。使用温莎城堡 + S#arp
我正在将我的应用程序转换为多租户应用程序,我的障碍之一是现在我必须在数据库中存储每个租户的设置。
我目前正在使用 DictionaryAdapter 将应用程序配置文件中的设置读取到 IConfigurationSettings 接口中。
因为我可以有很多租户,所以我认为我的配置设置需要使用不同的密钥注册到城堡,最好是主机名作为密钥。
然而,在城堡注册期间,我无法访问 Request 对象来获取我的主机名,而且我的 NHibernate 初始化也没有发生。
有人有任何建议吗?
保罗
I am converting my application to a multi-tenancy application, one of my obstacles is that now I have to store settings for each tenant in the database.
I am currently using the DictionaryAdapter to read the settings from my app config file into a IConfigurationSettings interface.
Because I can have many tenants, I think my configuration settings need to be registered to castle with different keys, ideally the host name as the key.
However, during the time of castle registration I don't have access to the Request object to get my hostname, also my NHibernate initialisation hasn't taken place.
Anyone got any suggustions?
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要获取每个租户的设置,那么在主数据库的NHibernate初始化并遍历租户之后,您是否可以不这样做?
另外,这些设置实际上需要在启动时加载吗?是否可以在需要时阅读它们,这可能是为了响应请求。
If you need to get the settings for each tenant, then can you not do this after the initialisation of NHibernate for the master database and iterate through the tenants?
Also, do the settings actually need to be loaded at startup? Can they be read when required, which will probably be in response to a request.