mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-26 10:49:20 +08:00
Saveable master-slave BUG
This commit is contained in:
@@ -8,8 +8,8 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtest";
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtest";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtesT";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,14 @@ namespace OrmTest.Demo
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
|
||||
|
||||
Console.WriteLine("");
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var db = GetMasterSlaveInstance();
|
||||
|
||||
var list = db.Insertable(new Student() { Name="aa" }).ExecuteCommand(); // ConnectionString2 or ConnectionString3
|
||||
db.Queryable<Student>().First();
|
||||
}
|
||||
//db.Insertable(new Student() { Name = "masterTest" }).ExecuteCommand();// Config.ConnectionString
|
||||
}
|
||||
@@ -31,7 +34,7 @@ namespace OrmTest.Demo
|
||||
IsAutoCloseConnection = true,
|
||||
SlaveConnectionConfigs = new List<SlaveConnectionConfig>() {
|
||||
new SlaveConnectionConfig() { HitRate=10, ConnectionString=Config.ConnectionString2 } ,
|
||||
new SlaveConnectionConfig() { HitRate=10, ConnectionString=Config.ConnectionString2 }
|
||||
new SlaveConnectionConfig() { HitRate=10, ConnectionString=Config.ConnectionString3 }
|
||||
}
|
||||
});
|
||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
|
||||
Reference in New Issue
Block a user