1234567891011121314151617181920212223242526 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading.Tasks;
- namespace WZExport.Models
- {
- public class DBConfig
- {
- [DisplayName("数据库")]
- public string DBName { get; set; }
- [DisplayName("连接字符串")]
- public string ConnectStr { get; set; }
- public bool Choose { get; set; }
- public static string GetChooseConnet()
- {
- string configStr = System.IO.File.ReadAllText("dBConfig.json");
- var dBConfigs = JsonConvert.DeserializeObject<List<DBConfig>>(configStr);
- return dBConfigs.FirstOrDefault(config => config.Choose == true).ConnectStr;
- }
- }
- }
|