mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Code optimization
This commit is contained in:
parent
0aa7d47328
commit
0d399cefc5
@ -35,7 +35,7 @@ namespace SqlSugar
|
|||||||
protected List<IDataParameter> OutputParameters { get; set; }
|
protected List<IDataParameter> OutputParameters { get; set; }
|
||||||
public virtual string SqlParameterKeyWord { get { return "@"; } }
|
public virtual string SqlParameterKeyWord { get { return "@"; } }
|
||||||
public IDbTransaction Transaction { get; set; }
|
public IDbTransaction Transaction { get; set; }
|
||||||
public virtual SqlSugarEngine Context { get; set; }
|
public virtual SqlSugarProvider Context { get; set; }
|
||||||
internal CommandType OldCommandType { get; set; }
|
internal CommandType OldCommandType { get; set; }
|
||||||
internal bool OldClearParameters { get; set; }
|
internal bool OldClearParameters { get; set; }
|
||||||
public IDataParameterCollection DataReaderParameters { get; set; }
|
public IDataParameterCollection DataReaderParameters { get; set; }
|
||||||
|
@ -8,12 +8,12 @@ namespace SqlSugar
|
|||||||
public class AopProvider
|
public class AopProvider
|
||||||
{
|
{
|
||||||
private AopProvider() { }
|
private AopProvider() { }
|
||||||
public AopProvider(SqlSugarEngine context)
|
public AopProvider(SqlSugarProvider context)
|
||||||
{
|
{
|
||||||
this.Context = context;
|
this.Context = context;
|
||||||
this.Context.Ado.IsEnableLogEvent = true;
|
this.Context.Ado.IsEnableLogEvent = true;
|
||||||
}
|
}
|
||||||
private SqlSugarEngine Context { get; set; }
|
private SqlSugarProvider Context { get; set; }
|
||||||
public Action<DiffLogModel> OnDiffLogEvent { set { this.Context.CurrentConnectionConfig.AopEvents.OnDiffLogEvent = value; } }
|
public Action<DiffLogModel> OnDiffLogEvent { set { this.Context.CurrentConnectionConfig.AopEvents.OnDiffLogEvent = value; } }
|
||||||
public Action<SqlSugarException> OnError { set { this.Context.CurrentConnectionConfig.AopEvents.OnError = value; } }
|
public Action<SqlSugarException> OnError { set { this.Context.CurrentConnectionConfig.AopEvents.OnError = value; } }
|
||||||
public Action<string, SugarParameter[]> OnLogExecuting { set { this.Context.CurrentConnectionConfig.AopEvents.OnLogExecuting= value; } }
|
public Action<string, SugarParameter[]> OnLogExecuting { set { this.Context.CurrentConnectionConfig.AopEvents.OnLogExecuting= value; } }
|
||||||
|
@ -8,7 +8,7 @@ namespace SqlSugar
|
|||||||
public partial class CodeFirstProvider : ICodeFirst
|
public partial class CodeFirstProvider : ICodeFirst
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
public virtual SqlSugarEngine Context { get; set; }
|
public virtual SqlSugarProvider Context { get; set; }
|
||||||
protected bool IsBackupTable { get; set; }
|
protected bool IsBackupTable { get; set; }
|
||||||
protected int MaxBackupDataRows { get; set; }
|
protected int MaxBackupDataRows { get; set; }
|
||||||
protected virtual int DefultLength { get; set; }
|
protected virtual int DefultLength { get; set; }
|
||||||
|
@ -7,7 +7,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial class DbBindAccessory
|
public partial class DbBindAccessory
|
||||||
{
|
{
|
||||||
protected List<T> GetEntityList<T>(SqlSugarEngine context, IDataReader dataReader)
|
protected List<T> GetEntityList<T>(SqlSugarProvider context, IDataReader dataReader)
|
||||||
{
|
{
|
||||||
Type type = typeof(T);
|
Type type = typeof(T);
|
||||||
var fieldNames = GetDataReaderNames(dataReader);
|
var fieldNames = GetDataReaderNames(dataReader);
|
||||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
|||||||
public abstract partial class DbBindProvider : DbBindAccessory, IDbBind
|
public abstract partial class DbBindProvider : DbBindAccessory, IDbBind
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
public virtual SqlSugarEngine Context { get; set; }
|
public virtual SqlSugarProvider Context { get; set; }
|
||||||
public abstract List<KeyValuePair<string, CSharpDataType>> MappingTypes { get; }
|
public abstract List<KeyValuePair<string, CSharpDataType>> MappingTypes { get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
private SqlSugarEngine Context = null;
|
private SqlSugarProvider Context = null;
|
||||||
private IDataReaderEntityBuilder<T> DynamicBuilder;
|
private IDataReaderEntityBuilder<T> DynamicBuilder;
|
||||||
private IDataRecord DataRecord;
|
private IDataRecord DataRecord;
|
||||||
private static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod("IsDBNull", new Type[] { typeof(int) });
|
private static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod("IsDBNull", new Type[] { typeof(int) });
|
||||||
@ -65,7 +65,7 @@ namespace SqlSugar
|
|||||||
private static readonly MethodInfo getOther = typeof(IDataRecordExtensions).GetMethod("GetOther");
|
private static readonly MethodInfo getOther = typeof(IDataRecordExtensions).GetMethod("GetOther");
|
||||||
private static readonly MethodInfo getSqliteTypeNull = typeof(IDataRecordExtensions).GetMethod("GetSqliteTypeNull");
|
private static readonly MethodInfo getSqliteTypeNull = typeof(IDataRecordExtensions).GetMethod("GetSqliteTypeNull");
|
||||||
private static readonly MethodInfo getSqliteType = typeof(IDataRecordExtensions).GetMethod("GetSqliteType");
|
private static readonly MethodInfo getSqliteType = typeof(IDataRecordExtensions).GetMethod("GetSqliteType");
|
||||||
private static readonly MethodInfo getEntity = typeof(IDataRecordExtensions).GetMethod("GetEntity", new Type[] { typeof(SqlSugarEngine) });
|
private static readonly MethodInfo getEntity = typeof(IDataRecordExtensions).GetMethod("GetEntity", new Type[] { typeof(SqlSugarProvider) });
|
||||||
|
|
||||||
private delegate T Load(IDataRecord dataRecord);
|
private delegate T Load(IDataRecord dataRecord);
|
||||||
private Load handler;
|
private Load handler;
|
||||||
@ -77,7 +77,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDataReaderEntityBuilder(SqlSugarEngine context, IDataRecord dataRecord,List<string> fieldNames)
|
public IDataReaderEntityBuilder(SqlSugarProvider context, IDataRecord dataRecord,List<string> fieldNames)
|
||||||
{
|
{
|
||||||
this.Context = context;
|
this.Context = context;
|
||||||
this.DataRecord = dataRecord;
|
this.DataRecord = dataRecord;
|
||||||
|
@ -243,7 +243,7 @@ namespace SqlSugar
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static object GetEntity(this IDataReader dr, SqlSugarEngine context)
|
public static object GetEntity(this IDataReader dr, SqlSugarProvider context)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
#region Context
|
#region Context
|
||||||
private ISqlBuilder _SqlBuilder;
|
private ISqlBuilder _SqlBuilder;
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public ISqlBuilder SqlBuilder
|
public ISqlBuilder SqlBuilder
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -9,7 +9,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class EntityMaintenance
|
public class EntityMaintenance
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
|
|
||||||
public EntityInfo GetEntityInfo<T>()
|
public EntityInfo GetEntityInfo<T>()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class QueryFilterProvider : IFilter
|
public class QueryFilterProvider : IFilter
|
||||||
{
|
{
|
||||||
internal SqlSugarEngine Context { get; set; }
|
internal SqlSugarProvider Context { get; set; }
|
||||||
private List<SqlFilterItem> _Filters { get; set; }
|
private List<SqlFilterItem> _Filters { get; set; }
|
||||||
|
|
||||||
public IFilter Add(SqlFilterItem filter)
|
public IFilter Add(SqlFilterItem filter)
|
||||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class InsertableProvider<T> : IInsertable<T> where T : class, new()
|
public class InsertableProvider<T> : IInsertable<T> where T : class, new()
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public IAdo Ado { get { return Context.Ado; } }
|
public IAdo Ado { get { return Context.Ado; } }
|
||||||
public ISqlBuilder SqlBuilder { get; set; }
|
public ISqlBuilder SqlBuilder { get; set; }
|
||||||
public InsertBuilder InsertBuilder { get; set; }
|
public InsertBuilder InsertBuilder { get; set; }
|
||||||
|
@ -1611,7 +1611,7 @@ namespace SqlSugar
|
|||||||
foreach (var item in result)
|
foreach (var item in result)
|
||||||
{
|
{
|
||||||
var contextProperty = item.GetType().GetProperty("Context");
|
var contextProperty = item.GetType().GetProperty("Context");
|
||||||
SqlSugarEngine newClient = this.Context.Utilities.CopyContext();
|
SqlSugarProvider newClient = this.Context.Utilities.CopyContext();
|
||||||
if (newClient.CurrentConnectionConfig.AopEvents == null)
|
if (newClient.CurrentConnectionConfig.AopEvents == null)
|
||||||
newClient.CurrentConnectionConfig.AopEvents = new AopEvents();
|
newClient.CurrentConnectionConfig.AopEvents = new AopEvents();
|
||||||
contextProperty.SetValue(item, newClient, null);
|
contextProperty.SetValue(item, newClient, null);
|
||||||
|
@ -9,19 +9,19 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial class SaveableProvider<T> : ISaveable<T> where T : class, new()
|
public partial class SaveableProvider<T> : ISaveable<T> where T : class, new()
|
||||||
{
|
{
|
||||||
internal SaveableProvider(SqlSugarEngine context,List<T> saveObjects)
|
internal SaveableProvider(SqlSugarProvider context,List<T> saveObjects)
|
||||||
{
|
{
|
||||||
this.saveObjects = saveObjects;
|
this.saveObjects = saveObjects;
|
||||||
this.Context = context;
|
this.Context = context;
|
||||||
this.Context.InitMppingInfo<T>();
|
this.Context.InitMppingInfo<T>();
|
||||||
}
|
}
|
||||||
internal SaveableProvider(SqlSugarEngine context, T saveObject)
|
internal SaveableProvider(SqlSugarProvider context, T saveObject)
|
||||||
{
|
{
|
||||||
this.saveObjects = new List<T>() { saveObject };
|
this.saveObjects = new List<T>() { saveObject };
|
||||||
this.Context = context;
|
this.Context = context;
|
||||||
this.Context.InitMppingInfo<T>();
|
this.Context.InitMppingInfo<T>();
|
||||||
}
|
}
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public List<T> saveObjects = new List<T>();
|
public List<T> saveObjects = new List<T>();
|
||||||
public List<T> existsObjects = null;
|
public List<T> existsObjects = null;
|
||||||
public List<T> insertObjects
|
public List<T> insertObjects
|
||||||
|
@ -13,7 +13,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
#region Common Properties
|
#region Common Properties
|
||||||
public EntityInfo EntityInfo { get; set; }
|
public EntityInfo EntityInfo { get; set; }
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public ILambdaExpressions LambdaExpressions { get; set; }
|
public ILambdaExpressions LambdaExpressions { get; set; }
|
||||||
public List<SugarParameter> Parameters { get; set; }
|
public List<SugarParameter> Parameters { get; set; }
|
||||||
public StringBuilder sql { get; set; }
|
public StringBuilder sql { get; set; }
|
||||||
|
@ -18,7 +18,7 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Common Properties
|
#region Common Properties
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public ILambdaExpressions LambdaExpressions { get; set; }
|
public ILambdaExpressions LambdaExpressions { get; set; }
|
||||||
public ISqlBuilder Builder { get; set; }
|
public ISqlBuilder Builder { get; set; }
|
||||||
public StringBuilder sql { get; set; }
|
public StringBuilder sql { get; set; }
|
||||||
|
@ -27,7 +27,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
#region Service object
|
#region Service object
|
||||||
public StringBuilder sql { get; set; }
|
public StringBuilder sql { get; set; }
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public ILambdaExpressions LambdaExpressions { get; set; }
|
public ILambdaExpressions LambdaExpressions { get; set; }
|
||||||
public ISqlBuilder Builder { get; set; }
|
public ISqlBuilder Builder { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
|||||||
public abstract partial class SqlBuilderProvider : SqlBuilderAccessory, ISqlBuilder
|
public abstract partial class SqlBuilderProvider : SqlBuilderAccessory, ISqlBuilder
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public CommandType CommandType { get; set; }
|
public CommandType CommandType { get; set; }
|
||||||
public DeleteBuilder DeleteBuilder { get; set; }
|
public DeleteBuilder DeleteBuilder { get; set; }
|
||||||
public InsertBuilder InsertBuilder { get; set; }
|
public InsertBuilder InsertBuilder { get; set; }
|
||||||
|
@ -17,7 +17,7 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public string Fields
|
public string Fields
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -17,7 +17,7 @@ namespace SqlSugar
|
|||||||
this.WhereValues = new List<string>();
|
this.WhereValues = new List<string>();
|
||||||
this.Parameters = new List<SugarParameter>();
|
this.Parameters = new List<SugarParameter>();
|
||||||
}
|
}
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public ILambdaExpressions LambdaExpressions { get; set; }
|
public ILambdaExpressions LambdaExpressions { get; set; }
|
||||||
public ISqlBuilder Builder { get; set; }
|
public ISqlBuilder Builder { get; set; }
|
||||||
public StringBuilder sql { get; set; }
|
public StringBuilder sql { get; set; }
|
||||||
|
@ -7,7 +7,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public partial class SqlSugarEngine
|
public partial class SqlSugarProvider
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
public ISqlSugarClient Context
|
public ISqlSugarClient Context
|
@ -15,11 +15,11 @@ namespace SqlSugar
|
|||||||
/// ** date:2017/1/2
|
/// ** date:2017/1/2
|
||||||
/// ** email:610262374@qq.com
|
/// ** email:610262374@qq.com
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class SqlSugarEngine: ISqlSugarClient
|
public partial class SqlSugarProvider: ISqlSugarClient
|
||||||
{
|
{
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
public SqlSugarEngine(ConnectionConfig config)
|
public SqlSugarProvider(ConnectionConfig config)
|
||||||
{
|
{
|
||||||
this.Context = this;
|
this.Context = this;
|
||||||
this.CurrentConnectionConfig = config;
|
this.CurrentConnectionConfig = config;
|
@ -12,7 +12,7 @@ namespace SqlSugar
|
|||||||
public class UpdateableProvider<T> : IUpdateable<T> where T : class, new()
|
public class UpdateableProvider<T> : IUpdateable<T> where T : class, new()
|
||||||
{
|
{
|
||||||
#region Property
|
#region Property
|
||||||
public SqlSugarEngine Context { get; internal set; }
|
public SqlSugarProvider Context { get; internal set; }
|
||||||
public EntityInfo EntityInfo { get; internal set; }
|
public EntityInfo EntityInfo { get; internal set; }
|
||||||
public ISqlBuilder SqlBuilder { get; internal set; }
|
public ISqlBuilder SqlBuilder { get; internal set; }
|
||||||
public UpdateBuilder UpdateBuilder { get; set; }
|
public UpdateBuilder UpdateBuilder { get; set; }
|
||||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public ISugarQueryable<T> CreateMapping<T>() where T : class, new()
|
public ISugarQueryable<T> CreateMapping<T>() where T : class, new()
|
||||||
{
|
{
|
||||||
Check.ArgumentNullException(Context, "Please use Sqlugar.ModelContext");
|
Check.ArgumentNullException(Context, "Please use Sqlugar.ModelContext");
|
||||||
|
@ -11,7 +11,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial class ContextMethods : IContextMethods
|
public partial class ContextMethods : IContextMethods
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
#region DataReader
|
#region DataReader
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -268,9 +268,9 @@ namespace SqlSugar
|
|||||||
return DeserializeObject<T>(jsonString);
|
return DeserializeObject<T>(jsonString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public SqlSugarEngine CopyContext(bool isCopyEvents = false)
|
public SqlSugarProvider CopyContext(bool isCopyEvents = false)
|
||||||
{
|
{
|
||||||
var newClient = new SqlSugarEngine(this.TranslateCopy(Context.CurrentConnectionConfig));
|
var newClient = new SqlSugarProvider(this.TranslateCopy(Context.CurrentConnectionConfig));
|
||||||
newClient.CurrentConnectionConfig.ConfigureExternalServices = Context.CurrentConnectionConfig.ConfigureExternalServices;
|
newClient.CurrentConnectionConfig.ConfigureExternalServices = Context.CurrentConnectionConfig.ConfigureExternalServices;
|
||||||
newClient.MappingColumns = this.TranslateCopy(Context.MappingColumns);
|
newClient.MappingColumns = this.TranslateCopy(Context.MappingColumns);
|
||||||
newClient.MappingTables = this.TranslateCopy(Context.MappingTables);
|
newClient.MappingTables = this.TranslateCopy(Context.MappingTables);
|
||||||
|
@ -17,7 +17,7 @@ namespace SqlSugar
|
|||||||
IDbTransaction Transaction { get; set; }
|
IDbTransaction Transaction { get; set; }
|
||||||
IDataParameter[] ToIDbDataParameter(params SugarParameter[] pars);
|
IDataParameter[] ToIDbDataParameter(params SugarParameter[] pars);
|
||||||
SugarParameter[] GetParameters(object obj, PropertyInfo[] propertyInfo = null);
|
SugarParameter[] GetParameters(object obj, PropertyInfo[] propertyInfo = null);
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
void ExecuteBefore(string sql, SugarParameter[] pars);
|
void ExecuteBefore(string sql, SugarParameter[] pars);
|
||||||
void ExecuteAfter(string sql, SugarParameter[] pars);
|
void ExecuteAfter(string sql, SugarParameter[] pars);
|
||||||
bool IsEnableLogEvent{get;set;}
|
bool IsEnableLogEvent{get;set;}
|
||||||
|
@ -6,7 +6,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial interface ICodeFirst
|
public partial interface ICodeFirst
|
||||||
{
|
{
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
ICodeFirst BackupTable(int maxBackupDataRows = int.MaxValue);
|
ICodeFirst BackupTable(int maxBackupDataRows = int.MaxValue);
|
||||||
ICodeFirst SetStringDefaultLength(int length);
|
ICodeFirst SetStringDefaultLength(int length);
|
||||||
void InitTables(string entitiesNamespace);
|
void InitTables(string entitiesNamespace);
|
||||||
|
@ -10,14 +10,14 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial interface IContextMethods
|
public partial interface IContextMethods
|
||||||
{
|
{
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
ExpandoObject DataReaderToExpandoObject(IDataReader reader);
|
ExpandoObject DataReaderToExpandoObject(IDataReader reader);
|
||||||
List<ExpandoObject> DataReaderToExpandoObjectList(IDataReader reader);
|
List<ExpandoObject> DataReaderToExpandoObjectList(IDataReader reader);
|
||||||
List<T> DataReaderToList<T>(IDataReader reader);
|
List<T> DataReaderToList<T>(IDataReader reader);
|
||||||
string SerializeObject(object value);
|
string SerializeObject(object value);
|
||||||
T DeserializeObject<T>(string value);
|
T DeserializeObject<T>(string value);
|
||||||
T TranslateCopy<T>(T sourceObject);
|
T TranslateCopy<T>(T sourceObject);
|
||||||
SqlSugarEngine CopyContext(bool isCopyEvents = false);
|
SqlSugarProvider CopyContext(bool isCopyEvents = false);
|
||||||
dynamic DataTableToDynamic(DataTable table);
|
dynamic DataTableToDynamic(DataTable table);
|
||||||
List<T> DataTableToList<T>(DataTable table);
|
List<T> DataTableToList<T>(DataTable table);
|
||||||
Dictionary<string, object> DataTableToDictionary(DataTable table);
|
Dictionary<string, object> DataTableToDictionary(DataTable table);
|
||||||
|
@ -9,7 +9,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
string SqlTemplate { get; }
|
string SqlTemplate { get; }
|
||||||
List<SugarParameter> Parameters { get; set; }
|
List<SugarParameter> Parameters { get; set; }
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
StringBuilder sql { get; set; }
|
StringBuilder sql { get; set; }
|
||||||
string ToSqlString();
|
string ToSqlString();
|
||||||
void Clear();
|
void Clear();
|
||||||
|
@ -7,7 +7,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial interface IDbBind
|
public partial interface IDbBind
|
||||||
{
|
{
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
List<string> GuidThrow { get; }
|
List<string> GuidThrow { get; }
|
||||||
List<string> IntThrow { get; }
|
List<string> IntThrow { get; }
|
||||||
List<string> StringThrow { get; }
|
List<string> StringThrow { get; }
|
||||||
|
@ -6,7 +6,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial interface IDbMaintenance
|
public partial interface IDbMaintenance
|
||||||
{
|
{
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
|
|
||||||
#region DML
|
#region DML
|
||||||
List<DbTableInfo> GetViewInfoList(bool isCache=true);
|
List<DbTableInfo> GetViewInfoList(bool isCache=true);
|
||||||
|
@ -15,7 +15,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
List<JoinQueryInfo> JoinQueryInfos { get; set; }
|
List<JoinQueryInfo> JoinQueryInfos { get; set; }
|
||||||
bool IsSingle { get; set; }
|
bool IsSingle { get; set; }
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
IDbMethods DbMehtods { get; set; }
|
IDbMethods DbMehtods { get; set; }
|
||||||
Expression Expression { get; set; }
|
Expression Expression { get; set; }
|
||||||
int Index { get; set; }
|
int Index { get; set; }
|
||||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial interface ISqlBuilder
|
public partial interface ISqlBuilder
|
||||||
{
|
{
|
||||||
SqlSugarEngine Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
CommandType CommandType { get; set; }
|
CommandType CommandType { get; set; }
|
||||||
String AppendWhereOrAnd(bool isWhere, string sqlString);
|
String AppendWhereOrAnd(bool isWhere, string sqlString);
|
||||||
string AppendHaving(string sqlString);
|
string AppendHaving(string sqlString);
|
||||||
|
@ -10,7 +10,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
internal class PostgreSQLExpressionContext : ExpressionContext, ILambdaExpressions
|
internal class PostgreSQLExpressionContext : ExpressionContext, ILambdaExpressions
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context
|
public SqlSugarProvider Context
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class MySqlExpressionContext : ExpressionContext, ILambdaExpressions
|
public class MySqlExpressionContext : ExpressionContext, ILambdaExpressions
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public MySqlExpressionContext()
|
public MySqlExpressionContext()
|
||||||
{
|
{
|
||||||
base.DbMehtods = new MySqlMethod();
|
base.DbMehtods = new MySqlMethod();
|
||||||
|
@ -11,7 +11,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial class OracleExpressionContext : ExpressionContext, ILambdaExpressions
|
public partial class OracleExpressionContext : ExpressionContext, ILambdaExpressions
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public OracleExpressionContext()
|
public OracleExpressionContext()
|
||||||
{
|
{
|
||||||
base.DbMehtods = new OracleMethod();
|
base.DbMehtods = new OracleMethod();
|
||||||
|
@ -11,7 +11,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public partial class SqlServerExpressionContext : ExpressionContext, ILambdaExpressions
|
public partial class SqlServerExpressionContext : ExpressionContext, ILambdaExpressions
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public SqlServerExpressionContext()
|
public SqlServerExpressionContext()
|
||||||
{
|
{
|
||||||
base.DbMehtods = new SqlServerMethod();
|
base.DbMehtods = new SqlServerMethod();
|
||||||
|
@ -4,7 +4,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class SqliteExpressionContext : ExpressionContext, ILambdaExpressions
|
public class SqliteExpressionContext : ExpressionContext, ILambdaExpressions
|
||||||
{
|
{
|
||||||
public SqlSugarEngine Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public SqliteExpressionContext()
|
public SqliteExpressionContext()
|
||||||
{
|
{
|
||||||
base.DbMehtods = new SqliteMethod();
|
base.DbMehtods = new SqliteMethod();
|
||||||
|
@ -279,8 +279,8 @@
|
|||||||
<Compile Include="Interface\IContextMethods.cs" />
|
<Compile Include="Interface\IContextMethods.cs" />
|
||||||
<Compile Include="Interface\IUpdateable.cs" />
|
<Compile Include="Interface\IUpdateable.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Abstract\SugarProvider\SqlSugarEngine_Part2.cs" />
|
<Compile Include="Abstract\SugarProvider\SqlSugarAccessory.cs" />
|
||||||
<Compile Include="Abstract\SugarProvider\SqlSugarEngine.cs" />
|
<Compile Include="Abstract\SugarProvider\SqlSugarProvider.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="References\MySql.Data.dll" />
|
<Content Include="References\MySql.Data.dll" />
|
||||||
|
@ -749,7 +749,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
config.AopEvents = new AopEvents();
|
config.AopEvents = new AopEvents();
|
||||||
}
|
}
|
||||||
_Context = new SqlSugarEngine(config);
|
_Context = new SqlSugarProvider(config);
|
||||||
if (!aopIsNull)
|
if (!aopIsNull)
|
||||||
_Context.Ado.IsEnableLogEvent = true;
|
_Context.Ado.IsEnableLogEvent = true;
|
||||||
this.CurrentConnectionConfig = config;
|
this.CurrentConnectionConfig = config;
|
||||||
|
@ -42,6 +42,6 @@ namespace SqlSugar
|
|||||||
internal static Type DicArraySS = typeof(Dictionary<string, string>);
|
internal static Type DicArraySS = typeof(Dictionary<string, string>);
|
||||||
internal static Type DicArraySO = typeof(Dictionary<string, object>);
|
internal static Type DicArraySO = typeof(Dictionary<string, object>);
|
||||||
|
|
||||||
public static Type SugarType = typeof(SqlSugarEngine);
|
public static Type SugarType = typeof(SqlSugarProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,18 @@ namespace SqlSugar
|
|||||||
public SqlSugarException(string message)
|
public SqlSugarException(string message)
|
||||||
: base(message){}
|
: base(message){}
|
||||||
|
|
||||||
public SqlSugarException(SqlSugarEngine context,string message, string sql)
|
public SqlSugarException(SqlSugarProvider context,string message, string sql)
|
||||||
: base(message) {
|
: base(message) {
|
||||||
this.Sql = sql;
|
this.Sql = sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlSugarException(SqlSugarEngine context, string message, string sql, object pars)
|
public SqlSugarException(SqlSugarProvider context, string message, string sql, object pars)
|
||||||
: base(message) {
|
: base(message) {
|
||||||
this.Sql = sql;
|
this.Sql = sql;
|
||||||
this.Parametres = pars;
|
this.Parametres = pars;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlSugarException(SqlSugarEngine context, Exception ex, string sql, object pars)
|
public SqlSugarException(SqlSugarProvider context, Exception ex, string sql, object pars)
|
||||||
: base(ex.Message)
|
: base(ex.Message)
|
||||||
{
|
{
|
||||||
this.Sql = sql;
|
this.Sql = sql;
|
||||||
@ -40,7 +40,7 @@ namespace SqlSugar
|
|||||||
this.Source = ex.Source;
|
this.Source = ex.Source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SqlSugarException(SqlSugarEngine context, string message, object pars)
|
public SqlSugarException(SqlSugarProvider context, string message, object pars)
|
||||||
: base(message) {
|
: base(message) {
|
||||||
this.Parametres = pars;
|
this.Parametres = pars;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user