mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update demo
This commit is contained in:
parent
f27ab97496
commit
5859b1b48c
@ -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());
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user