Delete unused code

This commit is contained in:
sunkaixuan 2017-06-19 01:40:24 +08:00
parent 0493b98c39
commit f264e5a222
7 changed files with 0 additions and 78 deletions

View File

@ -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;
}
}
}

View File

@ -42,7 +42,6 @@ namespace OrmTest
OrmTest.Demo.DbFirst.Init();
OrmTest.Demo.JoinSql.Init();
OrmTest.Demo.Filter.Init();
OrmTest.Demo.MaterSlave.Init();
OrmTest.Demo.ComplexModel.Init();
OrmTest.Demo.CodeFirst.Init();
}

View File

@ -56,7 +56,6 @@
<Compile Include="Demos\4_Delete.cs" />
<Compile Include="Demos\DemoBase.cs" />
<Compile Include="Demos\3_Insert.cs" />
<Compile Include="Demos\9_MasterSlave.cs" />
<Compile Include="Demos\1_Query.cs" />
<Compile Include="Demos\2_Update.cs" />
<Compile Include="Models\DataTestInfo.cs" />

View File

@ -31,8 +31,6 @@ namespace SqlSugar
public virtual string SqlParameterKeyWord { get { return "@"; } }
public IDbTransaction Transaction { 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
{
get

View File

@ -640,8 +640,6 @@ namespace SqlSugar
newClient.MappingColumns = this.Context.MappingColumns;
newClient.MappingTables = this.Context.MappingTables;
newClient.IgnoreColumns = this.Context.IgnoreColumns;
newClient.Ado.MasterConnectionConfig = this.Context.Ado.MasterConnectionConfig;
newClient.Ado.SlaveConnectionConfigs = this.Context.Ado.SlaveConnectionConfigs;
contextProperty.SetValue(item, newClient, null);
}
}

View File

@ -20,9 +20,6 @@ namespace SqlSugar
void ExecuteBefore(string sql, SugarParameter[] pars);
void ExecuteAfter(string sql, SugarParameter[] pars);
ConnectionConfig MasterConnectionConfig { get; set; }
List<ConnectionConfig> SlaveConnectionConfigs { get; set; }
CommandType CommandType { get; set; }
bool IsEnableLogEvent { get; set; }
Action<string, string> LogEventStarting { get; set; }

View File

@ -32,22 +32,6 @@ namespace SqlSugar
base.Context = this;
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
#region ADO Methods