public void testReadDbConfig() { string str = @"{ ConnectionStringTable : { default:""Provider=Microsoft.Jet.OLEDB.4.0;Data Source=wojilu.mdb"", db2:""server=localhost;uid=wojilusyy;pwd=test123;database=syyWojilu;"" }, IsCheckDatabase : true, MappingTablePrefix :"""", EnableContextCache : true, EnableApplicationCache : true, AssemblyList : [""wojilu.Core"",""wojilu.Apps""], MetaDLL : """" }"; MyDbConfig cf = Json.Deserialize <MyDbConfig>(str); Assert.IsNotNull(cf); Assert.AreEqual(2, cf.ConnectionStringTable.Count); Assert.AreEqual("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=wojilu.mdb", cf.ConnectionStringTable["default"]); Assert.AreEqual("server=localhost;uid=wojilusyy;pwd=test123;database=syyWojilu;", cf.ConnectionStringTable["db2"]); Assert.AreEqual(2, cf.AssemblyList.Count); Assert.AreEqual("wojilu.Core", cf.AssemblyList[0]); Assert.AreEqual("wojilu.Apps", cf.AssemblyList[1]); Assert.IsNull(cf.Interceptor); }
public void testDbConfig() { MyDbConfig cf = new MyDbConfig(); cf.ConnectionStringTable = new Dictionary <string, string>(); cf.ConnectionStringTable.Add("default", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=wojilu.mdb"); cf.ConnectionStringTable.Add("db2", "server=localhost;uid=wojilusyy;pwd=test123;database=syyWojilu;"); cf.AssemblyList = new List <string>(); cf.AssemblyList.Add("wojilu.Core"); cf.AssemblyList.Add("wojilu.Apps"); string str = Json.ToString(cf, true); Console.WriteLine(str); }
public void testDbConfig() { MyDbConfig cf = new MyDbConfig(); cf.ConnectionStringTable = new Dictionary<string, string>(); cf.ConnectionStringTable.Add( "default", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=wojilu.mdb" ); cf.ConnectionStringTable.Add( "db2", "server=localhost;uid=wojilusyy;pwd=test123;database=syyWojilu;" ); cf.AssemblyList = new List<string>(); cf.AssemblyList.Add( "wojilu.Core" ); cf.AssemblyList.Add( "wojilu.Apps" ); string str = Json.ToString( cf, true ); Console.WriteLine( str ); }