mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update demo
This commit is contained in:
parent
237a0d95dd
commit
15616575dc
@ -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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql, ConnectionString=Config.ConnectionString,InitKeyType=InitKeyType.Attribute,IsAutoCloseConnection=true },
|
new ConnectionConfig(){ ConfigId="1", DbType=DbType.Sqlite, ConnectionString=Config.ConnectionString,InitKeyType=InitKeyType.Attribute,IsAutoCloseConnection=true },
|
||||||
new ConnectionConfig(){ ConfigId="2", DbType=DbType.MySql, ConnectionString=Config.ConnectionString2 ,InitKeyType=InitKeyType.Attribute ,IsAutoCloseConnection=true}
|
new ConnectionConfig(){ ConfigId="2", DbType=DbType.Sqlite, 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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
AopEvents = new AopEvents()
|
AopEvents = new AopEvents()
|
||||||
|
@ -323,7 +323,7 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
return new SqlSugarClient(new ConnectionConfig()
|
return new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = SqlSugar.DbType.MySql,
|
DbType = SqlSugar.DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
Console.WriteLine("#### SqlQueryable Start ####");
|
Console.WriteLine("#### SqlQueryable Start ####");
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
|
@ -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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
|
@ -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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString3,
|
ConnectionString = Config.ConnectionString3,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -38,7 +38,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
public static SqlSugarClient GetInstance()
|
public static SqlSugarClient GetInstance()
|
||||||
{
|
{
|
||||||
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.MySql, ConnectionString = Config.ConnectionString, IsAutoCloseConnection = true });
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { DbType = DbType.Sqlite, 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()
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
<HintPath>OtherDll\SyntacticSugar.dll</HintPath>
|
<HintPath>OtherDll\SyntacticSugar.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
@ -10,7 +10,7 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
public static SqlSugarClient Db=> new SqlSugarClient(new ConnectionConfig()
|
public static SqlSugarClient Db=> new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
@ -12,7 +12,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
public static SqlSugarClient simpleDb => new SqlSugarClient(new ConnectionConfig()
|
public static SqlSugarClient simpleDb => new SqlSugarClient(new ConnectionConfig()
|
||||||
{
|
{
|
||||||
DbType = DbType.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
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.MySql,
|
DbType = DbType.Sqlite,
|
||||||
ConnectionString = Config.ConnectionString,
|
ConnectionString = Config.ConnectionString,
|
||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true,
|
IsAutoCloseConnection = true,
|
||||||
|
Loading…
Reference in New Issue
Block a user