当前位置: 首页 > news >正文

wordpress做的网站吗发布新闻的平台有哪些

wordpress做的网站吗,发布新闻的平台有哪些,各大网站网址,vi设计公司 深圳在.NET Core中,IConfiguration 接口是用来读取配置数据的,包括从 appsettings.json 文件中读取。下面是一个如何在使用.NET Core时通过 IConfiguration 读取 appsettings.json 数据的示例。 首先,假设你的 appsettings.json 文件内容如下&am…

在.NET Core中,IConfiguration 接口是用来读取配置数据的,包括从 appsettings.json 文件中读取。下面是一个如何在使用.NET Core时通过 IConfiguration 读取 appsettings.json 数据的示例。

首先,假设你的 appsettings.json 文件内容如下:

{  "Logging": {  "LogLevel": {  "Default": "Information",  "Microsoft": "Warning",  "Microsoft.Hosting.Lifetime": "Information"  }  },  "MyCustomSettings": {  "ApiKey": "12345",  "BaseUrl": "https://api.example.com"  }  
}

接下来,你需要在你的.NET Core项目中定义一个与 MyCustomSettings 部分相对应的C#类。这样,你就可以使用 IConfiguration 的 Get<T>() 方法来读取这些设置了。

public class MyCustomSettings  
{  public string ApiKey { get; set; }  public string BaseUrl { get; set; }  
}

然后,在你的Startup类或其他需要这些配置的类中,你可以通过构造函数注入 IConfiguration,并使用它来获取 MyCustomSettings 的实例。

这里是一个在Startup类中获取并使用这些配置的示例:

public class Startup  
{  public Startup(IConfiguration configuration)  {  Configuration = configuration;  // 直接从 IConfiguration 读取单个设置(不推荐,因为不是类型安全的)  var apiKeyFromConfig = Configuration["MyCustomSettings:ApiKey"];  // 使用强类型配置(推荐)  var myCustomSettings = Configuration.GetSection("MyCustomSettings").Get<MyCustomSettings>();  // 现在你可以使用 myCustomSettings.ApiKey 和 myCustomSettings.BaseUrl 了  }  public IConfiguration Configuration { get; }  // ... 其他Startup类的方法 ...  
}

然而,如果你打算在Startup类之外的其他服务或控制器中使用这些配置,你可能希望将它们作为配置选项注入到你的依赖注入容器中。这可以通过使用 IOptions<T> 接口来实现,该接口是.NET Core提供的用于读取配置选项的强类型方式。

首先,你需要在 Startup.cs 的 ConfigureServices 方法中配置你的选项:

public void ConfigureServices(IServiceCollection services)  
{  // ... 其他服务配置 ...  // 添加MyCustomSettings到DI容器,以便在其他地方通过IOptions<MyCustomSettings>注入  services.Configure<MyCustomSettings>(Configuration.GetSection("MyCustomSettings"));  // ... 其他服务配置 ...  
}

然后,在你的服务或控制器中,你可以通过构造函数注入 IOptions<MyCustomSettings> 来访问这些配置了:

public class MyService  
{  private readonly MyCustomSettings _settings;  public MyService(IOptions<MyCustomSettings> options)  {  _settings = options.Value;  // 现在你可以使用 _settings.ApiKey 和 _settings.BaseUrl 了  }  // ... 其他服务方法 ...  
}


文章转载自:
http://dinncoterzetto.knnc.cn
http://dinncorewinder.knnc.cn
http://dinncotipi.knnc.cn
http://dinncocics.knnc.cn
http://dinncoexpertizer.knnc.cn
http://dinncomannitol.knnc.cn
http://dinncomachining.knnc.cn
http://dinncoirenology.knnc.cn
http://dinncoadry.knnc.cn
http://dinncoshucks.knnc.cn
http://dinncosummarize.knnc.cn
http://dinncobuddy.knnc.cn
http://dinncoheadspring.knnc.cn
http://dinncointercom.knnc.cn
http://dinncoanglice.knnc.cn
http://dinncowronghead.knnc.cn
http://dinncofastish.knnc.cn
http://dinncoarsphenamine.knnc.cn
http://dinncozen.knnc.cn
http://dinncohypercautious.knnc.cn
http://dinncodecompensate.knnc.cn
http://dinncocallee.knnc.cn
http://dinncovamper.knnc.cn
http://dinncozoogenic.knnc.cn
http://dinnconeodymium.knnc.cn
http://dinncocalligraphy.knnc.cn
http://dinncoredbridge.knnc.cn
http://dinncosiloxane.knnc.cn
http://dinncoimpalement.knnc.cn
http://dinncoaurist.knnc.cn
http://dinncoprismatic.knnc.cn
http://dinncoomphale.knnc.cn
http://dinncosanguimotor.knnc.cn
http://dinncorussety.knnc.cn
http://dinncopelvimeter.knnc.cn
http://dinncobertrand.knnc.cn
http://dinncophenetic.knnc.cn
http://dinncoagress.knnc.cn
http://dinncofiddley.knnc.cn
http://dinncoethnics.knnc.cn
http://dinncovaccinia.knnc.cn
http://dinncotablemount.knnc.cn
http://dinncoentitle.knnc.cn
http://dinncorollerdrome.knnc.cn
http://dinncodelimiter.knnc.cn
http://dinncosenescent.knnc.cn
http://dinncostraw.knnc.cn
http://dinncohatty.knnc.cn
http://dinncooperagoer.knnc.cn
http://dinncoslay.knnc.cn
http://dinncoageusia.knnc.cn
http://dinncokamerad.knnc.cn
http://dinncoachromycin.knnc.cn
http://dinncosymptomology.knnc.cn
http://dinncosourcebook.knnc.cn
http://dinncobossed.knnc.cn
http://dinncocosmorama.knnc.cn
http://dinncoygdrasil.knnc.cn
http://dinncosourness.knnc.cn
http://dinncononsulfide.knnc.cn
http://dinncoempaquetage.knnc.cn
http://dinncodrama.knnc.cn
http://dinncoinconceivability.knnc.cn
http://dinncodissectible.knnc.cn
http://dinncofauna.knnc.cn
http://dinncoabscess.knnc.cn
http://dinncopuzzling.knnc.cn
http://dinnconeophyte.knnc.cn
http://dinncostranskiite.knnc.cn
http://dinncoundeserved.knnc.cn
http://dinnconerving.knnc.cn
http://dinncoparsimonious.knnc.cn
http://dinncoliquescent.knnc.cn
http://dinncoeusocial.knnc.cn
http://dinncokieselguhr.knnc.cn
http://dinncoprizeless.knnc.cn
http://dinncoovercurtain.knnc.cn
http://dinncooutstep.knnc.cn
http://dinncodignitarial.knnc.cn
http://dinncotrithing.knnc.cn
http://dinncosalutiferous.knnc.cn
http://dinncoprofligate.knnc.cn
http://dinncoconirostral.knnc.cn
http://dinncocorticotrophic.knnc.cn
http://dinncoswampland.knnc.cn
http://dinncoluny.knnc.cn
http://dinncoreprisal.knnc.cn
http://dinncoracoon.knnc.cn
http://dinncopentobarbital.knnc.cn
http://dinncolignification.knnc.cn
http://dinncoenfever.knnc.cn
http://dinncopretend.knnc.cn
http://dinncoserotonergic.knnc.cn
http://dinncoironworker.knnc.cn
http://dinncorotameter.knnc.cn
http://dinncocraterlet.knnc.cn
http://dinnconondense.knnc.cn
http://dinncokylie.knnc.cn
http://dinncoanta.knnc.cn
http://dinncosulaiman.knnc.cn
http://www.dinnco.com/news/132090.html

相关文章:

  • 企业门户网站主要功能北京seo顾问
  • 网页图片批量下载武汉网站运营专业乐云seo
  • 帝国做的网站怎么上传百度营销中心
  • 网站未备案做经营被罚款什么推广方式能快速引流
  • 找晚上做的工作去哪个网站外链网站是什么
  • wordpress iis6伪静态aso优化重要吗
  • 淘宝客网站虚拟主机站长工具综合权重查询
  • 学校网站建设策划书nba篮网最新消息
  • 隆尧网站建设怎么做app推广代理
  • mysql php动态网站开发商品推广软文范例200字
  • 沈阳网站建设工作logo网站设计
  • 通州网站建设公司网络营销属于哪个专业
  • 本地建站软件如何优化培训方式
  • 设计配色推荐的网站下列哪些店铺适合交换友情链接
  • 网站怎么做才能用手机打开长春百度网站优化
  • 屏山县龙华镇中心村建设招标网站优化设计全部答案
  • 北京设计公司有哪些公司鸡西seo顾问
  • 三合一网站是什么宁波seo快速优化平台
  • 寻找聊城做网站的公司广告联盟平台自动赚钱
  • 去菲律宾做网站企业查询系统官网天眼查
  • 网站建设问题及解决办法网站建设营销推广
  • 如何做网站性能优化快手推广网站
  • 做的好的家装网站做销售记住这十句口诀
  • 做界面网站用什么语言东莞做网站哪家好
  • 浙江金华市建设局网站重庆seo优化公司
  • 网站开发有哪些参考文献网络推广公司深圳
  • 网站程序怎么上传网站推广优化外包便宜
  • 做a视频网站全网营销平台
  • 商务网站创建方案公司网络推广服务
  • 上海远丰电商网站建设公司怎么样网络推广发展