您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

25 行
991 B

  1. using Microsoft.Extensions.Configuration;
  2. using Microsoft.Extensions.Configuration.Json;
  3. using System;
  4. namespace DataVAPI.ProcessServices.AppConfig
  5. {
  6. public class AppConfigurtaionServices
  7. {
  8. public static IConfiguration Configuration { get; set; }
  9. static AppConfigurtaionServices()
  10. {
  11. //ReloadOnChange = true 当appsettings.json被修改时重新加载
  12. Configuration = new ConfigurationBuilder()
  13. //.SetBasePath(Directory.GetCurrentDirectory())
  14. //AppDomain.CurrentDomain.BaseDirectory是程序集基目录,所以appsettings.json,需要复制一份放在程序集目录下,
  15. .SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
  16. .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
  17. .Build();
  18. //DataBus.DataBus.connStr = AppConfigurtaionServices.Configuration.GetSection("mongoDB:connStr").Value;
  19. }
  20. }
  21. }