Update demo

This commit is contained in:
sunkaixuan 2019-06-02 10:08:32 +08:00
parent f27ab97496
commit 5859b1b48c
2 changed files with 5 additions and 5 deletions

View File

@ -197,8 +197,8 @@ namespace OrmTest
Console.WriteLine("#### Distributed TransactionExample Start ####");
SqlSugarClient db = new SqlSugarClient(new List<ConnectionConfig>()
{
new ConnectionConfig(){ ConfigId=1, DbType=DbType.SqlServer, ConnectionString=Config.ConnectionString,InitKeyType=InitKeyType.Attribute,IsAutoCloseConnection=true },
new ConnectionConfig(){ ConfigId=2, DbType=DbType.SqlServer, ConnectionString=Config.ConnectionString2 ,InitKeyType=InitKeyType.Attribute ,IsAutoCloseConnection=true}
new ConnectionConfig(){ ConfigId="1", DbType=DbType.SqlServer, ConnectionString=Config.ConnectionString,InitKeyType=InitKeyType.Attribute,IsAutoCloseConnection=true },
new ConnectionConfig(){ ConfigId="2", DbType=DbType.SqlServer, ConnectionString=Config.ConnectionString2 ,InitKeyType=InitKeyType.Attribute ,IsAutoCloseConnection=true}
});
//use db1
@ -298,11 +298,11 @@ namespace OrmTest
if (result.IsSuccess == false)
{
Console.WriteLine("---Roll back");
db.ChangeDatabase(it => it.DbType == DbType.SqlServer);//use sqlserver
db.ChangeDatabase("1");//use sqlserver
Console.WriteLine(db.CurrentConnectionConfig.DbType);
Console.WriteLine(db.Queryable<Order>().Count());
db.ChangeDatabase(it => it.DbType == DbType.MySql);//use mysql
db.ChangeDatabase("2");//use mysql
Console.WriteLine(db.CurrentConnectionConfig.DbType);
Console.WriteLine(db.Queryable<Order>().Count());
}

View File

@ -39,7 +39,7 @@ namespace OrmTest
saveDiary.Time = DateTime.Now;
saveDiary.IsRemind = false;//无论传false/true 最终执行的结果都是以true执行的
var sql = Db.Updateable<Diary>().SetColumns(it => new Diary()
var sql = Db.Updateable<UnitDiary>().SetColumns(it => new UnitDiary()
{
IsRemind = saveDiary.IsRemind,
}).Where(it => it.ID == saveDiary.ID).ToSql();