Update Demo

This commit is contained in:
sunkaixuan 2019-06-04 13:29:07 +08:00
parent a97843b3b6
commit 996bef1aa1
21 changed files with 51 additions and 51 deletions

View File

@ -28,7 +28,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
ConnectionString = Config.ConnectionString,//Master Connection ConnectionString = Config.ConnectionString,//Master Connection
DbType = DbType.SqlServer, DbType = DbType.MySql,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
SlaveConnectionConfigs = new List<SlaveConnectionConfig>() { SlaveConnectionConfigs = new List<SlaveConnectionConfig>() {
@ -53,7 +53,7 @@ namespace OrmTest
Console.WriteLine("#### SqlSugarClient Start ####"); Console.WriteLine("#### SqlSugarClient Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -146,7 +146,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer, DbType = DbType.MySql,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
ConfigureExternalServices = new ConfigureExternalServices() ConfigureExternalServices = new ConfigureExternalServices()
@ -209,7 +209,7 @@ namespace OrmTest
new ConnectionConfig() new ConnectionConfig()
{ {
ConfigId = 1, ConfigId = 1,
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -226,8 +226,8 @@ namespace OrmTest
Console.WriteLine("#### Distributed TransactionExample Start ####"); Console.WriteLine("#### Distributed TransactionExample Start ####");
SqlSugarClient db = new SqlSugarClient(new List<ConnectionConfig>() 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="1", DbType=DbType.MySql, 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="2", DbType=DbType.MySql, ConnectionString=Config.ConnectionString2 ,InitKeyType=InitKeyType.Attribute ,IsAutoCloseConnection=true}
}); });
//use db1 //use db1
@ -352,7 +352,7 @@ namespace OrmTest
Db = new SqlSugarClient(new ConnectionConfig() Db = new SqlSugarClient(new ConnectionConfig()
{ {
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer, DbType = DbType.MySql,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
AopEvents = new AopEvents() AopEvents = new AopEvents()
@ -386,7 +386,7 @@ namespace OrmTest
Db = new SqlSugarClient(new ConnectionConfig() Db = new SqlSugarClient(new ConnectionConfig()
{ {
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer, DbType = DbType.MySql,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
AopEvents = new AopEvents() AopEvents = new AopEvents()

View File

@ -189,7 +189,7 @@ namespace OrmTest
Console.WriteLine("#### No Entity Start ####"); Console.WriteLine("#### No Entity Start ####");
var db = GetInstance(); var db = GetInstance();
var list = db.Queryable<dynamic>().AS("order ").Where("id=id", new { id = 1 }).ToList(); var list = db.Queryable<dynamic>().AS("order").Where("id=id", new { id = 1 }).ToList();
var list2 = db.Queryable<dynamic>("o").AS("order").AddJoinInfo("OrderDetail", "i", "o.id=i.OrderId").Where("id=id", new { id = 1 }).Select("o.*").ToList(); var list2 = db.Queryable<dynamic>("o").AS("order").AddJoinInfo("OrderDetail", "i", "o.id=i.OrderId").Where("id=id", new { id = 1 }).Select("o.*").ToList();
Console.WriteLine("#### No Entity End ####"); Console.WriteLine("#### No Entity End ####");
@ -252,7 +252,7 @@ namespace OrmTest
//id=@id //id=@id
var list4 = db.Queryable<Order>().Where("id=@id", new { id = 1 }).ToList(); var list4 = db.Queryable<Order>().Where("id=@id", new { id = 1 }).ToList();
//id=@id or name like '%'+@name+'%' //id=@id or name like '%'+@name+'%'
var list5 = db.Queryable<Order>().Where("id=@id or name like '%'+@name+'%' ", new { id = 1, name = "jack" }).ToList(); var list5 = db.Queryable<Order>().Where("id=@id or name like @name ", new { id = 1, name = "%jack%" }).ToList();
@ -323,7 +323,7 @@ namespace OrmTest
{ {
return new SqlSugarClient(new ConnectionConfig() return new SqlSugarClient(new ConnectionConfig()
{ {
DbType = SqlSugar.DbType.SqlServer, DbType = SqlSugar.DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -78,8 +78,8 @@ namespace OrmTest
var dtList = new List<Dictionary<string, object>>(); var dtList = new List<Dictionary<string, object>>();
dtList.Add(dt); dtList.Add(dt);
var t66 = db.Updateable(dt).AS("[Order]").WhereColumns("id").ExecuteCommand(); var t66 = db.Updateable(dt).AS("`order`").WhereColumns("id").ExecuteCommand();
var t666 = db.Updateable(dtList).AS("[Order]").WhereColumns("id").ExecuteCommand(); var t666 = db.Updateable(dtList).AS("`order`").WhereColumns("id").ExecuteCommand();

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,20 +16,20 @@ namespace OrmTest
Console.WriteLine("#### SqlQueryable Start ####"); Console.WriteLine("#### SqlQueryable Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true IsAutoCloseConnection = true
}); });
int total = 0; int total = 0;
var list = db.SqlQueryable<Student>("select * from [order]").ToPageList(1, 2, ref total); var list = db.SqlQueryable<Student>("select * from `order`").ToPageList(1, 2, ref total);
//by expression //by expression
var list2 = db.SqlQueryable<Student>("select * from [order]").Where(it => it.Id == 1).ToPageList(1, 2); var list2 = db.SqlQueryable<Student>("select * from `order`").Where(it => it.Id == 1).ToPageList(1, 2);
//by sql //by sql
var list3 = db.SqlQueryable<Student>("select * from [order]").Where("id=@id", new { id = 1 }).ToPageList(1, 2); var list3 = db.SqlQueryable<Student>("select * from `order`").Where("id=@id", new { id = 1 }).ToPageList(1, 2);
Console.WriteLine("#### SqlQueryable End ####"); Console.WriteLine("#### SqlQueryable End ####");
} }

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -43,7 +43,7 @@ namespace OrmTest
db.Queryable<Order>().AddQueue(); db.Queryable<Order>().AddQueue();
db.Queryable<Order>().AddQueue(); db.Queryable<Order>().AddQueue();
db.AddQueue("select * from [Order] where id=@id", new { id = 10000 }); db.AddQueue("select * from `order` where id=@id", new { id = 10000 });
var result2 = db.SaveQueues<Order, Order, Order>(); var result2 = db.SaveQueues<Order, Order, Order>();
Console.WriteLine("#### Queue End ####"); Console.WriteLine("#### Queue End ####");

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -30,13 +30,13 @@ namespace OrmTest
} }
}); });
//sql //sql
var dt = db.Ado.GetDataTable("select * from [order] where @id>0 or name=@name", new List<SugarParameter>(){ var dt = db.Ado.GetDataTable("select * from `order` where @id>0 or name=@name", new List<SugarParameter>(){
new SugarParameter("@id",1), new SugarParameter("@id",1),
new SugarParameter("@name","2") new SugarParameter("@name","2")
}); });
//sql //sql
var dt2 = db.Ado.GetDataTable("select * from [order] where @id>0 or name=@name", new { id = 1, name = "2" }); var dt2 = db.Ado.GetDataTable("select * from `order` where @id>0 or name=@name", new { id = 1, name = "2" });
//Stored Procedure //Stored Procedure
//var dt3 = db.Ado.UseStoredProcedure().GetDataTable("sp_school", new { name = "张三", age = 0 }); //var dt3 = db.Ado.UseStoredProcedure().GetDataTable("sp_school", new { name = "张三", age = 0 });
@ -47,9 +47,9 @@ namespace OrmTest
//There are many methods to under db.ado //There are many methods to under db.ado
var list= db.Ado.SqlQuery<Order>("select * from [order] "); var list= db.Ado.SqlQuery<Order>("select * from `order` ");
var intValue=db.Ado.SqlQuerySingle<int>("select 1"); var intValue=db.Ado.SqlQuerySingle<int>("select 1");
db.Ado.ExecuteCommand("delete [order] where id>1000"); db.Ado.ExecuteCommand("delete from `order` where id>1000");
//db.Ado.xxx //db.Ado.xxx
Console.WriteLine("#### Ado End ####"); Console.WriteLine("#### Ado End ####");
} }

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true IsAutoCloseConnection = true

View File

@ -14,7 +14,7 @@ namespace OrmTest
Console.WriteLine("#### DbFirst Start ####"); Console.WriteLine("#### DbFirst Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true IsAutoCloseConnection = true

View File

@ -14,7 +14,7 @@ namespace OrmTest
Console.WriteLine("#### CodeFirst Start ####"); Console.WriteLine("#### CodeFirst Start ####");
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString3, ConnectionString = Config.ConnectionString3,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true IsAutoCloseConnection = true

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -37,7 +37,7 @@ namespace OrmTest
Console.WriteLine(string.Join("," ,list)); Console.WriteLine(string.Join("," ,list));
}); });
var list2= db.Utilities.DataTableToList<Order>(db.Ado.GetDataTable("select * from [order]")); var list2= db.Utilities.DataTableToList<Order>(db.Ado.GetDataTable("select * from `order`"));
//more https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities //more https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities
Console.WriteLine("#### Utilities End ####"); Console.WriteLine("#### Utilities End ####");

View File

@ -16,7 +16,7 @@ namespace OrmTest
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -16,21 +16,21 @@ namespace OrmTest
var sql = db.Queryable<Order>().ToSql(); var sql = db.Queryable<Order>().ToSql();
//SELECT [Id],[Name],[Price],[CreateTime] FROM [Order] WHERE isDelete=0 //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` WHERE isDelete=0
Console.WriteLine(sql); Console.WriteLine(sql);
var sql2 = db.Queryable<Order,OrderItem>((main,ot)=> main.Id==ot.OrderId).ToSql(); var sql2 = db.Queryable<Order,OrderItem>((main,ot)=> main.Id==ot.OrderId).ToSql();
//SELECT [Id],[Name],[Price],[CreateTime] FROM [Order] main ,[OrderDetail] ot WHERE ( [main].[Id] = [ot].[OrderId] ) AND main.isDelete=0 //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` main ,[OrderDetail] ot WHERE ( [main].[Id] = [ot].[OrderId] ) AND main.isDelete=0
Console.WriteLine(sql2); Console.WriteLine(sql2);
var sql3 = db.Queryable<Order>().Filter("Myfilter").ToSql();// Myfilter+Gobal var sql3 = db.Queryable<Order>().Filter("Myfilter").ToSql();// Myfilter+Gobal
//SELECT [Id],[Name],[Price],[CreateTime] FROM [Order] WHERE Name='jack' AND isDelete=0 //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` WHERE Name='jack' AND isDelete=0
Console.WriteLine(sql3); Console.WriteLine(sql3);
var sql4 = db.Queryable<Order>().Filter("Myfilter",isDisabledGobalFilter:true).ToSql();//only Myfilter var sql4 = db.Queryable<Order>().Filter("Myfilter",isDisabledGobalFilter:true).ToSql();//only Myfilter
//SELECT [Id],[Name],[Price],[CreateTime] FROM [Order] WHERE Name='jack' //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` WHERE Name='jack'
Console.WriteLine(sql4); Console.WriteLine(sql4);
Console.WriteLine("#### Filter End ####"); Console.WriteLine("#### Filter End ####");
} }
@ -38,7 +38,7 @@ namespace OrmTest
public static SqlSugarClient GetInstance() public static SqlSugarClient GetInstance()
{ {
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.SqlServer, ConnectionString = Config.ConnectionString, IsAutoCloseConnection = true }); SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.MySql, ConnectionString = Config.ConnectionString, IsAutoCloseConnection = true });
//single table query gobal filter //single table query gobal filter
db.QueryFilter.Add(new SqlFilterItem() db.QueryFilter.Add(new SqlFilterItem()

View File

@ -10,7 +10,7 @@ namespace OrmTest
{ {
public static SqlSugarClient Db=> new SqlSugarClient(new ConnectionConfig() public static SqlSugarClient Db=> new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,

View File

@ -48,9 +48,9 @@ namespace OrmTest
task8.Wait(); task8.Wait();
UValidate.Check(8, task8.Result[0].id, "ado"); UValidate.Check(8, task8.Result[0].id, "ado");
var task9=Db.Ado.SqlQuery<Order, OrderItem>("select * from [order];select * from OrderDetail"); var task9=Db.Ado.SqlQuery<Order, OrderItem>("select * from `order`;select * from OrderDetail");
var task10 = Db.Ado.SqlQueryAsync<Order, OrderItem>("select * from [order];select * from OrderDetail"); var task10 = Db.Ado.SqlQueryAsync<Order, OrderItem>("select * from `order`;select * from OrderDetail");
task10.Wait(); task10.Wait();
} }
} }

View File

@ -46,11 +46,11 @@ namespace OrmTest
[Dc]=@Dc,[IntNull]=@IntNull WHERE [Int]=@Int", "Queryable"); [Dc]=@Dc,[IntNull]=@IntNull WHERE [Int]=@Int", "Queryable");
sql = Db.Queryable<Order>().IgnoreColumns(it => it.CreateTime).ToSql().Key; sql = Db.Queryable<Order>().IgnoreColumns(it => it.CreateTime).ToSql().Key;
UValidate.Check(sql, "SELECT [Id],[Name],[Price],[CustomId] FROM [Order] ", "Queryable"); UValidate.Check(sql, "SELECT [Id],[Name],[Price],[CustomId] FROM `order` ", "Queryable");
sql = Db.Queryable<Order>().IgnoreColumns(it => new { it.Id, it.Name }).ToSql().Key; sql = Db.Queryable<Order>().IgnoreColumns(it => new { it.Id, it.Name }).ToSql().Key;
UValidate.Check(sql, "SELECT [Price],[CreateTime],[CustomId] FROM [Order] ", "Queryable"); UValidate.Check(sql, "SELECT [Price],[CreateTime],[CustomId] FROM `order` ", "Queryable");
sql = Db.Queryable<Order>().IgnoreColumns("id").ToSql().Key; sql = Db.Queryable<Order>().IgnoreColumns("id").ToSql().Key;
UValidate.Check(sql, "SELECT [Name],[Price],[CreateTime],[CustomId] FROM [Order] ", "Queryable"); UValidate.Check(sql, "SELECT [Name],[Price],[CreateTime],[CustomId] FROM `order` ", "Queryable");
var cts = IEnumerbleContains.Data(); var cts = IEnumerbleContains.Data();
var list2=Db.Queryable<Order>() var list2=Db.Queryable<Order>()

View File

@ -12,7 +12,7 @@ namespace OrmTest
public static SqlSugarClient simpleDb => new SqlSugarClient(new ConnectionConfig() public static SqlSugarClient simpleDb => new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -27,7 +27,7 @@ namespace OrmTest
}); });
public static SqlSugarClient ssDb => new SqlSugarClient(new ConnectionConfig() public static SqlSugarClient ssDb => new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -43,7 +43,7 @@ namespace OrmTest
}); });
public static SqlSugarClient singleDb = new SqlSugarClient(new ConnectionConfig() public static SqlSugarClient singleDb = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,
@ -58,7 +58,7 @@ namespace OrmTest
}); });
public static SqlSugarClient singleAndSsDb = new SqlSugarClient(new ConnectionConfig() public static SqlSugarClient singleAndSsDb = new SqlSugarClient(new ConnectionConfig()
{ {
DbType = DbType.SqlServer, DbType = DbType.MySql,
ConnectionString = Config.ConnectionString, ConnectionString = Config.ConnectionString,
InitKeyType = InitKeyType.Attribute, InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true, IsAutoCloseConnection = true,