mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 12:33:44 +08:00
Delete unused code
This commit is contained in:
@@ -1,53 +0,0 @@
|
|||||||
using OrmTest.Demo;
|
|
||||||
using OrmTest.Models;
|
|
||||||
using SqlSugar;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace OrmTest.Demo
|
|
||||||
{
|
|
||||||
|
|
||||||
public class MaterSlave : DemoBase
|
|
||||||
{
|
|
||||||
public static void Init()
|
|
||||||
{
|
|
||||||
var db = GetMasterSlaveInstance();
|
|
||||||
var insertObject = new Student()
|
|
||||||
{
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
Name = Guid.NewGuid().ToString(),
|
|
||||||
SchoolId = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
var id= db.Insertable(insertObject).ExecuteReutrnIdentity();
|
|
||||||
|
|
||||||
var sudent = db.Queryable<Student>().InSingle(id);
|
|
||||||
|
|
||||||
db.Deleteable<Student>().In(id).ExecuteCommand();
|
|
||||||
}
|
|
||||||
public static SqlSugarClient GetMasterSlaveInstance()
|
|
||||||
{
|
|
||||||
SqlSugarClient db = new SqlSugarClient(
|
|
||||||
//master Write and transaction operations
|
|
||||||
new ConnectionConfig() { ConnectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugar4XTest", DbType = DbType.SqlServer, IsAutoCloseConnection = true },
|
|
||||||
|
|
||||||
//Read operation
|
|
||||||
new ConnectionConfig[] {
|
|
||||||
|
|
||||||
new ConnectionConfig() { ConnectionString = "SERVER=.;UID=SA;PWD=SASA;DATABASE=SQLSUGAR4XTEST", DbType = DbType.SqlServer, IsAutoCloseConnection = true },
|
|
||||||
//Can be more than one
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
db.Ado.IsEnableLogEvent = true;
|
|
||||||
db.Ado.LogEventStarting = (sql, pars) =>
|
|
||||||
{
|
|
||||||
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
|
|
||||||
Console.WriteLine();
|
|
||||||
};
|
|
||||||
return db;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -42,7 +42,6 @@ namespace OrmTest
|
|||||||
OrmTest.Demo.DbFirst.Init();
|
OrmTest.Demo.DbFirst.Init();
|
||||||
OrmTest.Demo.JoinSql.Init();
|
OrmTest.Demo.JoinSql.Init();
|
||||||
OrmTest.Demo.Filter.Init();
|
OrmTest.Demo.Filter.Init();
|
||||||
OrmTest.Demo.MaterSlave.Init();
|
|
||||||
OrmTest.Demo.ComplexModel.Init();
|
OrmTest.Demo.ComplexModel.Init();
|
||||||
OrmTest.Demo.CodeFirst.Init();
|
OrmTest.Demo.CodeFirst.Init();
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,6 @@
|
|||||||
<Compile Include="Demos\4_Delete.cs" />
|
<Compile Include="Demos\4_Delete.cs" />
|
||||||
<Compile Include="Demos\DemoBase.cs" />
|
<Compile Include="Demos\DemoBase.cs" />
|
||||||
<Compile Include="Demos\3_Insert.cs" />
|
<Compile Include="Demos\3_Insert.cs" />
|
||||||
<Compile Include="Demos\9_MasterSlave.cs" />
|
|
||||||
<Compile Include="Demos\1_Query.cs" />
|
<Compile Include="Demos\1_Query.cs" />
|
||||||
<Compile Include="Demos\2_Update.cs" />
|
<Compile Include="Demos\2_Update.cs" />
|
||||||
<Compile Include="Models\DataTestInfo.cs" />
|
<Compile Include="Models\DataTestInfo.cs" />
|
||||||
|
@@ -31,8 +31,6 @@ namespace SqlSugar
|
|||||||
public virtual string SqlParameterKeyWord { get { return "@"; } }
|
public virtual string SqlParameterKeyWord { get { return "@"; } }
|
||||||
public IDbTransaction Transaction { get; set; }
|
public IDbTransaction Transaction { get; set; }
|
||||||
public virtual SqlSugarClient Context { get; set; }
|
public virtual SqlSugarClient Context { get; set; }
|
||||||
public virtual ConnectionConfig MasterConnectionConfig { get; set; }
|
|
||||||
public virtual List<ConnectionConfig> SlaveConnectionConfigs { get; set; }
|
|
||||||
public virtual IDbBind DbBind
|
public virtual IDbBind DbBind
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@@ -640,8 +640,6 @@ namespace SqlSugar
|
|||||||
newClient.MappingColumns = this.Context.MappingColumns;
|
newClient.MappingColumns = this.Context.MappingColumns;
|
||||||
newClient.MappingTables = this.Context.MappingTables;
|
newClient.MappingTables = this.Context.MappingTables;
|
||||||
newClient.IgnoreColumns = this.Context.IgnoreColumns;
|
newClient.IgnoreColumns = this.Context.IgnoreColumns;
|
||||||
newClient.Ado.MasterConnectionConfig = this.Context.Ado.MasterConnectionConfig;
|
|
||||||
newClient.Ado.SlaveConnectionConfigs = this.Context.Ado.SlaveConnectionConfigs;
|
|
||||||
contextProperty.SetValue(item, newClient, null);
|
contextProperty.SetValue(item, newClient, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,9 +20,6 @@ namespace SqlSugar
|
|||||||
void ExecuteBefore(string sql, SugarParameter[] pars);
|
void ExecuteBefore(string sql, SugarParameter[] pars);
|
||||||
void ExecuteAfter(string sql, SugarParameter[] pars);
|
void ExecuteAfter(string sql, SugarParameter[] pars);
|
||||||
|
|
||||||
ConnectionConfig MasterConnectionConfig { get; set; }
|
|
||||||
List<ConnectionConfig> SlaveConnectionConfigs { get; set; }
|
|
||||||
|
|
||||||
CommandType CommandType { get; set; }
|
CommandType CommandType { get; set; }
|
||||||
bool IsEnableLogEvent { get; set; }
|
bool IsEnableLogEvent { get; set; }
|
||||||
Action<string, string> LogEventStarting { get; set; }
|
Action<string, string> LogEventStarting { get; set; }
|
||||||
|
@@ -32,22 +32,6 @@ namespace SqlSugar
|
|||||||
base.Context = this;
|
base.Context = this;
|
||||||
base.CurrentConnectionConfig = config;
|
base.CurrentConnectionConfig = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read / write mode
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="masterConnectionConfig"></param>
|
|
||||||
/// <param name="slaveConnectionConfigs"></param>
|
|
||||||
public SqlSugarClient(ConnectionConfig masterConnectionConfig, ConnectionConfig[] slaveConnectionConfigs)
|
|
||||||
{
|
|
||||||
base.Context = this;
|
|
||||||
base.CurrentConnectionConfig = masterConnectionConfig;
|
|
||||||
if (slaveConnectionConfigs.IsNullOrEmpty()) return;
|
|
||||||
|
|
||||||
var db = this.Ado;
|
|
||||||
db.MasterConnectionConfig = masterConnectionConfig;
|
|
||||||
db.SlaveConnectionConfigs = slaveConnectionConfigs.ToList();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ADO Methods
|
#region ADO Methods
|
||||||
|
Reference in New Issue
Block a user