利用标准 IConfiguration 行为基于运行时值覆盖 Appsettings.json 配置
我想知道是否有一种方法可以利用标准 IConfiguration、IOption 覆盖功能来根据每个请求评估的数据覆盖 appsettings 配置值。
我有一个多租户应用程序,我希望整个平台有一些通用的默认配置值,但我还希望能够为每个租户甚至每个租户内的每个“部门”覆盖其中的一些值。
我将租户和部门的配置以 Json 形式存储在数据库中,并且在解析租户后,我希望能够根据请求将 appsettings 值与数据库中的值合并/覆盖。
显然我可以手动完成,但我想知道是否可以集成和利用标准 asp.net core IConfiguration/IOption 已经工作的合并/覆盖功能。
I'm wondering if there's a way to exploit the standard IConfiguration, IOption override functionality to override appsettings configuration values based on per request evaluated data.
I have a multi tenant application and I'd like to have some common default configuration values for the whole platform but I'd like also to be able to override some of them per Tenant or even per "Division" inside each tenant.
I store the Tenant's and Division's configurations as Json in the database and I'd like to be able to merge/override the appsettings values with those in the db per request once resolved the tenant.
Obviously I can do it manually but I'm wondering if I can integrate and exploit the already working merging/override functionality of the standard asp.net core IConfiguration/IOption.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论