public void CreateComponentConfigTest()
 {
     ConfigServerConfig csc = new ConfigServerConfig()
     {
         DalConfigs = new List<DataAccessConfiguration>()
     };
     csc.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "SolutionConfiguration",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     csc.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "ComponentConnection",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     csc.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "ComponentConfiguration",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     ConfigServer _server = new ConfigServer();
     var r = _server.CreateComponentConfig(new ComponentConfiguration()
     {
         ComponentId = 1001,
         Content = XmlConfigSerializer.Instance.ToXml<ConfigServerConfig>(csc),
         Environment = 1,
         CreateBy = 1,
         IsActive = true,
         Enable = true,
         IsDebug = false,
         IsDelete = false,
         Signature = "无签名",
         Version = 1
     });
     Assert.IsTrue(r.ActionResult);
     Assert.IsTrue(r.Data > 0);
 }
 static void Main(string[] args)
 {
     string path = @"D:\Github\Micro-enterpriseDistributedSystem\InformationModule\C#\mds\UnitTest\Config";
     SolutionConfiguration sc = new SolutionConfiguration()
     {
         Components = new List<ComponentConfiguration>(),
         Content = "",
         Enable = true,
         Environment = 0,
         ID = 1,
         IsFile = true,
         IsRemote = false,
         SolutionId = Guid.NewGuid(),
         SolutionName = "方案名称",
         Version = 1
     };
     ConfigServerConfig csc = new ConfigServerConfig()
     {
         DalConfigs = new List<DataAccessConfiguration>()
     };
     csc.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "SolutionConfiguration",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     csc.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "ComponentConnection",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     csc.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "ComponentConfiguration",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     sc.Components.Add(new ComponentConfiguration()
     {
         Version = 1,
         Status = 1,
         ComponentConfigId = 1,
         ComponentId = 1001,
         Content = XmlConfigSerializer.Instance.ToXml<ConfigServerConfig>(csc),
         Enable = true,
         Environment = 1,
         IsDebug = false,
         Signature = "软件签名"
     });
     ServiceFactoryServerConfig sfs = new ServiceFactoryServerConfig()
     {
         DalConfigs = new List<DataAccessConfiguration>()
     };
     sfs.DalConfigs = new List<DataAccessConfiguration>();
     sfs.DalConfigs.Add(new DataAccessConfiguration()
     {
         ConnectionName = "SolutionServiceFactoryConnection",
         DatabaseConnection = "Data Source=192.168.100.4;Initial Catalog=systembase;Persist Security Info=True;User ID=webuser;password=123456",
         DatabaseType = EnumDatabaseType.MySql,
         Multiple = false
     });
     sc.Components.Add(new ComponentConfiguration()
     {
         Version = 1,
         Status = 1,
         ComponentConfigId = 2,
         ComponentId = 1003,
         Content = XmlConfigSerializer.Instance.ToXml<ServiceFactoryServerConfig>(sfs),
         Enable = true,
         Environment = 1,
         IsDebug = false,
         Signature = "软件签名"
     });
     XmlConfigSerializer.Instance.Serializer(path + "\\RemoteConfig.xml", sc);
 }
 static ConfigHelper()
 {
     _configService = ConfigClientFactory.Instance.GetConfigClient();
     _compoentConfig = _configService.GetComponentConfig(DefineTable.ComponentID);//不进行null检查保证配置初始化出现问题时爆出异常
     _config= XmlConfigSerializer.Instance.FromXml<ConfigServerConfig>(_compoentConfig.Content);//不进行null检查保证配置初始化出现问题时爆出异常
 }