Asp.net core .Net Core使用数据库配置服务
我现在有一个工作地点。 但ı必须对现场系统进行一些更改。 现在我从appsetting.json读取条带设置并配置Asp.net core .Net Core使用数据库配置服务,asp.net-core,appsettings,Asp.net Core,Appsettings,我现在有一个工作地点。 但ı必须对现场系统进行一些更改。 现在我从appsetting.json读取条带设置并配置 services.Configure<StripeSettings>(Configuration.GetSection("Stripe")); services.Configure(Configuration.GetSection(“Stripe”); 但我必须将此设置移动到我的数据库中并从那里读取。如何在startup.cs中从数据库配置此设置
services.Configure<StripeSettings>(Configuration.GetSection("Stripe"));
services.Configure(Configuration.GetSection(“Stripe”);
但我必须将此设置移动到我的数据库中并从那里读取。如何在startup.cs中从数据库配置此设置。
我可以从数据库获取数据,但此方法需要IConfiguration对象。 我如何转换它。
谢谢。如果有人需要,我用这段代码解决了这个问题
services.Configure<StripeSettings>(opt => {
opt.PublishableKey = "value1";
opt.SecretKey = "value2";
});
services.Configure(opt=>{
opt.PublishableKey=“value1”;
opt.SecretKey=“value2”;
});
检查