| | |
| | | |
| | | public class AppsettingsUtility |
| | | { |
| | | private static AppSettings _appSettings; |
| | | |
| | | public static AppSettings Settings |
| | | { |
| | | get { return _appSettings; } |
| | | } |
| | | public static AppSettings Settings { get; private set; } |
| | | |
| | | public void Initial(IConfiguration configuration) |
| | | { |
| | | AppSettings myOwn = new AppSettings(); |
| | | var myOwn = new AppSettings(); |
| | | //注意:可以使用冒号来获取内层的配置项 |
| | | myOwn.TestErpUrl = configuration["AppSettings:TestErpUrl"]; |
| | | myOwn.ProductionErpUrl = configuration["AppSettings:ProductionErpUrl"]; |
| | | myOwn.DataBaseConn = configuration["AppSettings:DataBaseConn"]; |
| | | _appSettings = myOwn; |
| | | Settings = myOwn; |
| | | } |
| | | } |