Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
5d6601f811
  1. 2
      SqlServerTest/Demo/Delete.cs
  2. 2
      SqlServerTest/Demo/Insert.cs
  3. 2
      SqlServerTest/Demo/Query.cs
  4. 2
      SqlServerTest/Demo/Update.cs
  5. 2
      SqlServerTest/PerformanceTesting/SqlSugarPerformance.cs
  6. 2
      SqlServerTest/UnitTest/Delete.cs
  7. 2
      SqlServerTest/UnitTest/Insert.cs
  8. 2
      SqlServerTest/UnitTest/Mapping .cs
  9. 2
      SqlServerTest/UnitTest/Query/JoinQuery.cs
  10. 2
      SqlServerTest/UnitTest/Query/SelectQuery.cs
  11. 2
      SqlServerTest/UnitTest/Query/SingleQuery.cs
  12. 2
      SqlServerTest/UnitTest/Setting/AutoClose.cs
  13. 2
      SqlServerTest/UnitTest/Setting/MapColumn.cs
  14. 2
      SqlServerTest/UnitTest/Setting/MapTable.cs
  15. 2
      SqlServerTest/UnitTest/Update.cs
  16. 4
      SqlSugar/Abstract/AdoProvider/AdoProvider.cs
  17. 2
      SqlSugar/Common/Check.cs
  18. 29
      SqlSugar/Entities/ConnectionConfig.cs
  19. 63
      SqlSugar/InstanceFactory.cs
  20. 4
      SqlSugar/Interface/IAdo.cs
  21. 15
      SqlSugar/Interface/IConnectionConfig.cs
  22. 1
      SqlSugar/SqlSugar.csproj
  23. 2
      SqlSugar/SqlSugarAccessory.cs
  24. 36
      SqlSugar/SqlSugarClient.cs

2
SqlServerTest/Demo/Delete.cs

@ -32,7 +32,7 @@ namespace OrmTest.Demo
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{

2
SqlServerTest/Demo/Insert.cs

@ -53,7 +53,7 @@ namespace OrmTest.Demo
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{

2
SqlServerTest/Demo/Query.cs

@ -265,7 +265,7 @@ namespace OrmTest.Demo
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig{ ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{

2
SqlServerTest/Demo/Update.cs

@ -56,7 +56,7 @@ namespace OrmTest.Demo
}
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{

2
SqlServerTest/PerformanceTesting/SqlSugarPerformance.cs

@ -16,7 +16,7 @@ namespace OrmTest.PerformanceTesting
}
public void Select()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig()
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = Config.ConnectionString,
DbType = DbType.SqlServer,

2
SqlServerTest/UnitTest/Delete.cs

@ -55,7 +55,7 @@ namespace OrmTest
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}

2
SqlServerTest/UnitTest/Insert.cs

@ -119,7 +119,7 @@ new List<SugarParameter>() {
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}

2
SqlServerTest/UnitTest/Mapping .cs

@ -39,7 +39,7 @@ namespace OrmTest.UnitTest
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new AttributeConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() {InitKeyType=InitKeyType.Attribute, ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}

2
SqlServerTest/UnitTest/Query/JoinQuery.cs

@ -71,7 +71,7 @@ namespace OrmTest.UnitTest
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
{

2
SqlServerTest/UnitTest/Query/SelectQuery.cs

@ -87,7 +87,7 @@ namespace OrmTest.UnitTest
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
return db;
}
}

2
SqlServerTest/UnitTest/Query/SingleQuery.cs

@ -116,7 +116,7 @@ namespace OrmTest.UnitTest
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
return db;
}
}

2
SqlServerTest/UnitTest/Setting/AutoClose.cs

@ -29,7 +29,7 @@ namespace OrmTest.UnitTest
}
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}

2
SqlServerTest/UnitTest/Setting/MapColumn.cs

@ -11,7 +11,7 @@ namespace OrmTest.UnitTest
{
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
return db;
}
}

2
SqlServerTest/UnitTest/Setting/MapTable.cs

@ -25,7 +25,7 @@ namespace OrmTest.UnitTest
}
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}

2
SqlServerTest/UnitTest/Update.cs

@ -128,7 +128,7 @@ UNION ALL
public SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new SystemTableConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
return db;
}
}

4
SqlSugar/Abstract/AdoProvider/AdoProvider.cs

@ -26,8 +26,8 @@ namespace SqlSugar
}
public IDbTransaction Transaction { get; set; }
public virtual SqlSugarClient Context { get; set; }
public virtual IConnectionConfig MasterConnectionConfig { get; set; }
public virtual List<IConnectionConfig> SlaveConnectionConfigs { get; set; }
public virtual ConnectionConfig MasterConnectionConfig { get; set; }
public virtual List<ConnectionConfig> SlaveConnectionConfigs { get; set; }
public virtual IDbBind DbBind
{
get

2
SqlSugar/Common/Check.cs

@ -12,7 +12,7 @@ namespace SqlSugar
throw new SqlSugarException("SqlSugarException.NotSupportedException:" + message);
}
public static void ConnectionConfig(IConnectionConfig config)
public static void ConnectionConfig(ConnectionConfig config)
{
if (config == null || config.ConnectionString.IsNullOrEmpty() || config.DbType.IsNullOrEmpty())
{

29
SqlSugar/Entities/ConnectionConfig.cs

@ -5,17 +5,34 @@ using System.Text;
using System.Threading.Tasks;
namespace SqlSugar
{
public class SystemTableConfig : IConnectionConfig
public class ConnectionConfig
{
/// <summary>
///DbType.SqlServer Or Other
/// </summary>
public string DbType { get; set; }
/// <summary>
///Database Connection string
/// </summary>
public string ConnectionString { get; set; }
/// <summary>
/// true does not need to close the connection
/// </summary>
public bool IsAutoCloseConnection { get; set; }
/// <summary>
/// Default SystemTable,If you do not have system table permissions, use attribute
/// </summary>
public InitKeyType InitKeyType = InitKeyType.SystemTable;
}
public class AttributeConfig : IConnectionConfig
public enum InitKeyType
{
public string DbType { get; set; }
public string ConnectionString { get; set; }
public bool IsAutoCloseConnection { get; set; }
/// <summary>
/// Init primary key and identity key from the system table
/// </summary>
SystemTable = 0,
/// <summary>
/// Init primary key and identity key from the attribute
/// </summary>
Attribute = 1
}
}

63
SqlSugar/InstanceFactory.cs

@ -12,65 +12,57 @@ namespace SqlSugar
static Dictionary<string, Type> typeCache = new Dictionary<string, Type>();
#region Queryable
public static ISugarQueryable<T> GetQueryable<T>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T> GetQueryable<T>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T> reval = CreateInstance<T, ISugarQueryable<T>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2> GetQueryable<T, T2>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2> GetQueryable<T, T2>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2> reval = CreateInstance<T, T2, ISugarQueryable<T, T2>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2, T3> GetQueryable<T, T2, T3>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2, T3> GetQueryable<T, T2, T3>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2, T3> reval = CreateInstance<T, T2, T3, ISugarQueryable<T, T2, T3>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2, T3, T4> GetQueryable<T, T2, T3, T4>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2, T3, T4> GetQueryable<T, T2, T3, T4>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2, T3, T4> reval = CreateInstance<T, T2, T3, T4, ISugarQueryable<T, T2, T3, T4>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2, T3, T4, T5> GetQueryable<T, T2, T3, T4, T5>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2, T3, T4, T5> GetQueryable<T, T2, T3, T4, T5>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2, T3, T4, T5> reval = CreateInstance<T, T2, T3, T4, T5, ISugarQueryable<T, T2, T3, T4, T5>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2, T3, T4, T5, T6> GetQueryable<T, T2, T3, T4, T5, T6>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2, T3, T4, T5, T6> GetQueryable<T, T2, T3, T4, T5, T6>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2, T3, T4, T5, T6> reval = CreateInstance<T, T2, T3, T4, T5, T6, ISugarQueryable<T, T2, T3, T4, T5, T6>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7> GetQueryable<T, T2, T3, T4, T5, T6, T7>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7> GetQueryable<T, T2, T3, T4, T5, T6, T7>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7> reval = CreateInstance<T, T2, T3, T4, T5, T6, T7, ISugarQueryable<T, T2, T3, T4, T5, T6, T7>>(className, currentConnectionConfig.DbType);
return reval;
}
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(IConnectionConfig currentConnectionConfig)
public static ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> GetQueryable<T, T2, T3, T4, T5, T6, T7, T8>(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
string className = "Queryable";
className = GetClassName(currentConnectionConfig.DbType, className);
ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8> reval = CreateInstance<T, T2, T3, T4, T5, T6, T7, T8, ISugarQueryable<T, T2, T3, T4, T5, T6, T7, T8>>(className, currentConnectionConfig.DbType);
@ -78,76 +70,65 @@ namespace SqlSugar
}
#endregion
public static QueryBuilder GetQueryBuilder(IConnectionConfig currentConnectionConfig)
public static QueryBuilder GetQueryBuilder(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
QueryBuilder reval = CreateInstance<QueryBuilder>(GetClassName(currentConnectionConfig.DbType, "QueryBuilder"), currentConnectionConfig.DbType);
return reval;
}
public static InsertBuilder GetInsertBuilder(IConnectionConfig currentConnectionConfig)
public static InsertBuilder GetInsertBuilder(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
InsertBuilder reval = CreateInstance<InsertBuilder>(GetClassName(currentConnectionConfig.DbType, "InsertBuilder"), currentConnectionConfig.DbType);
return reval;
}
public static UpdateBuilder GetUpdateBuilder(IConnectionConfig currentConnectionConfig)
public static UpdateBuilder GetUpdateBuilder(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
UpdateBuilder reval = CreateInstance<UpdateBuilder>(GetClassName(currentConnectionConfig.DbType, "UpdateBuilder"), currentConnectionConfig.DbType);
return reval;
}
public static DeleteBuilder GetDeleteBuilder(IConnectionConfig currentConnectionConfig)
public static DeleteBuilder GetDeleteBuilder(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
DeleteBuilder reval = CreateInstance<DeleteBuilder>(GetClassName(currentConnectionConfig.DbType, "DeleteBuilder"), currentConnectionConfig.DbType);
return reval;
}
public static ILambdaExpressions GetLambdaExpressions(IConnectionConfig currentConnectionConfig)
public static ILambdaExpressions GetLambdaExpressions(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
ILambdaExpressions reval = CreateInstance<ILambdaExpressions>(GetClassName(currentConnectionConfig.DbType, "ExpressionContext"), currentConnectionConfig.DbType);
return reval;
}
public static ISqlBuilder GetSqlbuilder(IConnectionConfig currentConnectionConfig)
public static ISqlBuilder GetSqlbuilder(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
ISqlBuilder reval = CreateInstance<ISqlBuilder>(GetClassName(currentConnectionConfig.DbType, "Builder"), currentConnectionConfig.DbType);
return reval;
}
public static IDbBind GetDbBind(IConnectionConfig currentConnectionConfig)
public static IDbBind GetDbBind(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
IDbBind reval = CreateInstance<IDbBind>(GetClassName(currentConnectionConfig.DbType, "DbBind"), currentConnectionConfig.DbType);
return reval;
}
public static IDbMaintenance GetDbMaintenance(IConnectionConfig currentConnectionConfig)
public static IDbMaintenance GetDbMaintenance(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
IDbMaintenance reval = CreateInstance<IDbMaintenance>(GetClassName(currentConnectionConfig.DbType, "DbMaintenance"), currentConnectionConfig.DbType);
return reval;
}
public static IDbFirst GetDbFirst(IConnectionConfig currentConnectionConfig)
public static IDbFirst GetDbFirst(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
IDbFirst reval = CreateInstance<IDbFirst>(GetClassName(currentConnectionConfig.DbType, "DbFirst"), currentConnectionConfig.DbType);
return reval;
}
public static ICodeFirst GetCodeFirst(IConnectionConfig currentConnectionConfig)
public static ICodeFirst GetCodeFirst(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
ICodeFirst reval = CreateInstance<ICodeFirst>(GetClassName(currentConnectionConfig.DbType, "CodeFirst"), currentConnectionConfig.DbType);
return reval;
}
public static IAdo GetAdo(IConnectionConfig currentConnectionConfig)
public static IAdo GetAdo(ConnectionConfig currentConnectionConfig)
{
CheckConfig(currentConnectionConfig);
IAdo reval = CreateInstance<IAdo>(GetClassName(currentConnectionConfig.DbType, "Provider"), currentConnectionConfig.DbType);
return reval;
}
@ -365,11 +346,5 @@ namespace SqlSugar
return reval;
}
#endregion
private static void CheckConfig(IConnectionConfig currentConnectionConfig)
{
Check.ArgumentNullException(currentConnectionConfig, ErrorMessage.ConnectionConfigIsNull);
}
}
}

4
SqlSugar/Interface/IAdo.cs

@ -19,8 +19,8 @@ namespace SqlSugar
SqlSugarClient Context { get; set; }
void ExecLogEvent(string sql, SugarParameter[] pars, bool isStarting = true);
IConnectionConfig MasterConnectionConfig { get; set; }
List<IConnectionConfig> SlaveConnectionConfigs { get; set; }
ConnectionConfig MasterConnectionConfig { get; set; }
List<ConnectionConfig> SlaveConnectionConfigs { get; set; }
CommandType CommandType { get; set; }
bool IsEnableLogEvent { get; set; }

15
SqlSugar/Interface/IConnectionConfig.cs

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SqlSugar
{
public interface IConnectionConfig
{
string DbType { get; set; }
string ConnectionString { get; set; }
bool IsAutoCloseConnection { get; set; }
}
}

1
SqlSugar/SqlSugar.csproj

@ -62,7 +62,6 @@
<Compile Include="Abstract\DeleteProvider\DeleteableProvider.cs" />
<Compile Include="Abstract\UpdateProvider\UpdateableProvider.cs" />
<Compile Include="Entities\SugarMessageResult.cs" />
<Compile Include="Interface\IConnectionConfig.cs" />
<Compile Include="Realization\MySql\DbType.cs" />
<Compile Include="Realization\MySql\Core\DbBind\MySqlDbBind.cs" />
<Compile Include="Realization\MySql\Core\SqlBuilder\MySqlBuilder.cs" />

2
SqlSugar/SqlSugarAccessory.cs

@ -12,7 +12,7 @@ namespace SqlSugar
#region Properties
public SqlSugarClient Context { get; set; }
public string EntityNamespace { get; set; }
public IConnectionConfig CurrentConnectionConfig { get; set; }
public ConnectionConfig CurrentConnectionConfig { get; set; }
public Dictionary<string, object> TempItems { get; set; }
public Guid ContextID { get; set; }
public MappingTableList MappingTables = new MappingTableList();

36
SqlSugar/SqlSugarClient.cs

@ -21,51 +21,24 @@ namespace SqlSugar
{
get
{
return this.CurrentConnectionConfig is SystemTableConfig;
return this.CurrentConnectionConfig.InitKeyType==InitKeyType.SystemTable;
}
}
#endregion
#region Constructor
/// <summary>
/// If you have system table permissions, use this
/// </summary>
/// <param name="config"></param>
public SqlSugarClient(SystemTableConfig config)
public SqlSugarClient(ConnectionConfig config)
{
base.Context = this;
base.CurrentConnectionConfig = config;
}
/// <summary>
/// If you do not have system table permissions, use this
/// </summary>
/// <param name="config"></param>
public SqlSugarClient(AttributeConfig config)
{
base.Context = this;
base.CurrentConnectionConfig = config;
}
/// <summary>
/// Read / write mode. If you have system table permissions, use this
/// </summary>
/// <param name="masterConnectionConfig"></param>
/// <param name="slaveConnectionConfigs"></param>
public SqlSugarClient(SystemTableConfig masterConnectionConfig, IConnectionConfig[] slaveConnectionConfigs)
{
base.Context = this;
base.CurrentConnectionConfig = masterConnectionConfig;
if (slaveConnectionConfigs.IsNullOrEmpty()) return;
var db = this.Ado;
db.MasterConnectionConfig = masterConnectionConfig;
db.SlaveConnectionConfigs = slaveConnectionConfigs.ToList();
}
/// <summary>
/// Read / write mode. If you do not have system table permissions, use this
/// Read / write mode
/// </summary>
/// <param name="masterConnectionConfig"></param>
/// <param name="slaveConnectionConfigs"></param>
public SqlSugarClient(AttributeConfig masterConnectionConfig, IConnectionConfig[] slaveConnectionConfigs)
public SqlSugarClient(ConnectionConfig masterConnectionConfig, ConnectionConfig[] slaveConnectionConfigs)
{
base.Context = this;
base.CurrentConnectionConfig = masterConnectionConfig;
@ -75,7 +48,6 @@ namespace SqlSugar
db.MasterConnectionConfig = masterConnectionConfig;
db.SlaveConnectionConfigs = slaveConnectionConfigs.ToList();
}
#endregion
#region ADO Method

Loading…
Cancel
Save