mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-04 12:47:57 +08:00
Update aop & oracle date
This commit is contained in:
parent
12e9923b60
commit
e58b8a60c2
@ -1434,6 +1434,7 @@ namespace SqlSugar
|
|||||||
this.Connection = this.MasterConnection;
|
this.Connection = this.MasterConnection;
|
||||||
this.Context.CurrentConnectionConfig.ConnectionString = this.MasterConnectionString;
|
this.Context.CurrentConnectionConfig.ConnectionString = this.MasterConnectionString;
|
||||||
}
|
}
|
||||||
|
this.Context.SugarActionType = SugarActionType.UnKnown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsRead(string sql)
|
private bool IsRead(string sql)
|
||||||
|
@ -31,6 +31,7 @@ namespace SqlSugar
|
|||||||
public MappingColumnList MappingColumns { get; set; }
|
public MappingColumnList MappingColumns { get; set; }
|
||||||
public IgnoreColumnList IgnoreColumns { get; set; }
|
public IgnoreColumnList IgnoreColumns { get; set; }
|
||||||
public IgnoreColumnList IgnoreInsertColumns { get; set; }
|
public IgnoreColumnList IgnoreInsertColumns { get; set; }
|
||||||
|
public SugarActionType SugarActionType { get; set; } = SugarActionType.UnKnown;
|
||||||
public ConfigQuery ConfigQuery {
|
public ConfigQuery ConfigQuery {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -258,6 +259,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
protected ISugarQueryable<T> CreateQueryable<T>(ISugarQueryable<T> result)
|
protected ISugarQueryable<T> CreateQueryable<T>(ISugarQueryable<T> result)
|
||||||
{
|
{
|
||||||
|
this.SugarActionType = SugarActionType.Query;
|
||||||
Check.Exception(typeof(T).IsClass() == false || typeof(T).GetConstructors().Length == 0, "Queryable<{0}> Error ,{0} is invalid , need is a class,and can new().", typeof(T).Name);
|
Check.Exception(typeof(T).IsClass() == false || typeof(T).GetConstructors().Length == 0, "Queryable<{0}> Error ,{0} is invalid , need is a class,and can new().", typeof(T).Name);
|
||||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(CurrentConnectionConfig);
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(CurrentConnectionConfig);
|
||||||
result.Context = this.Context;
|
result.Context = this.Context;
|
||||||
@ -272,6 +274,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
protected InsertableProvider<T> CreateInsertable<T>(T[] insertObjs) where T : class, new()
|
protected InsertableProvider<T> CreateInsertable<T>(T[] insertObjs) where T : class, new()
|
||||||
{
|
{
|
||||||
|
this.SugarActionType = SugarActionType.Insert;
|
||||||
var result = InstanceFactory.GetInsertableProvider<T>(this.CurrentConnectionConfig);
|
var result = InstanceFactory.GetInsertableProvider<T>(this.CurrentConnectionConfig);
|
||||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||||
result.Context = this;
|
result.Context = this;
|
||||||
@ -287,6 +290,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
protected DeleteableProvider<T> CreateDeleteable<T>() where T : class, new()
|
protected DeleteableProvider<T> CreateDeleteable<T>() where T : class, new()
|
||||||
{
|
{
|
||||||
|
this.SugarActionType = SugarActionType.Delete;
|
||||||
var result = InstanceFactory.GetDeleteableProvider<T>(this.CurrentConnectionConfig);
|
var result = InstanceFactory.GetDeleteableProvider<T>(this.CurrentConnectionConfig);
|
||||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||||
result.Context = this;
|
result.Context = this;
|
||||||
@ -299,6 +303,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
protected UpdateableProvider<T> CreateUpdateable<T>(T[] UpdateObjs) where T : class, new()
|
protected UpdateableProvider<T> CreateUpdateable<T>(T[] UpdateObjs) where T : class, new()
|
||||||
{
|
{
|
||||||
|
this.SugarActionType = SugarActionType.Update;
|
||||||
var result = InstanceFactory.GetUpdateableProvider<T>(this.CurrentConnectionConfig);
|
var result = InstanceFactory.GetUpdateableProvider<T>(this.CurrentConnectionConfig);
|
||||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||||
result.Context = this;
|
result.Context = this;
|
||||||
@ -315,6 +320,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
protected void CreateQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
protected void CreateQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
||||||
{
|
{
|
||||||
|
this.SugarActionType = SugarActionType.Query;
|
||||||
this.CreateQueryable<T>(queryable);
|
this.CreateQueryable<T>(queryable);
|
||||||
string shortName = string.Empty;
|
string shortName = string.Empty;
|
||||||
List<SugarParameter> paramters = new List<SugarParameter>();
|
List<SugarParameter> paramters = new List<SugarParameter>();
|
||||||
@ -328,6 +334,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
protected void CreateEasyQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
protected void CreateEasyQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
||||||
{
|
{
|
||||||
|
this.SugarActionType = SugarActionType.Query;
|
||||||
this.CreateQueryable<T>(queryable);
|
this.CreateQueryable<T>(queryable);
|
||||||
string shortName = string.Empty;
|
string shortName = string.Empty;
|
||||||
queryable.SqlBuilder.QueryBuilder.EasyJoinInfos = this.GetEasyJoinInfo(joinExpression, ref shortName, queryable.SqlBuilder, types);
|
queryable.SqlBuilder.QueryBuilder.EasyJoinInfos = this.GetEasyJoinInfo(joinExpression, ref shortName, queryable.SqlBuilder, types);
|
||||||
|
@ -1199,7 +1199,8 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region
|
|
||||||
|
#region Fastest
|
||||||
public IFastest<T> Fastest<T>() where T:class,new()
|
public IFastest<T> Fastest<T>() where T:class,new()
|
||||||
{
|
{
|
||||||
return new FastestProvider<T>(this);
|
return new FastestProvider<T>(this);
|
||||||
|
17
Src/Asp.Net/SqlSugar/Enum/SugarActionType.cs
Normal file
17
Src/Asp.Net/SqlSugar/Enum/SugarActionType.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public enum SugarActionType
|
||||||
|
{
|
||||||
|
Insert=0,
|
||||||
|
Update=1,
|
||||||
|
Delete=2,
|
||||||
|
Query=3,
|
||||||
|
UnKnown = -1
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ namespace SqlSugar
|
|||||||
EntityMaintenance EntityMaintenance { get; set; }
|
EntityMaintenance EntityMaintenance { get; set; }
|
||||||
QueryFilterProvider QueryFilter { get; set; }
|
QueryFilterProvider QueryFilter { get; set; }
|
||||||
IContextMethods Utilities { get; set; }
|
IContextMethods Utilities { get; set; }
|
||||||
|
SugarActionType SugarActionType { get; set; }
|
||||||
|
|
||||||
#region Deleteable
|
#region Deleteable
|
||||||
IDeleteable<T> Deleteable<T>() where T : class, new();
|
IDeleteable<T> Deleteable<T>() where T : class, new();
|
||||||
|
@ -163,10 +163,18 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (parameter.DbType == System.Data.DbType.DateTime)
|
else if (parameter.DbType == System.Data.DbType.DateTime)
|
||||||
|
{
|
||||||
|
if (this.Context.SugarActionType == SugarActionType.Insert)
|
||||||
|
{
|
||||||
|
sqlParameter.Value = parameter.Value;
|
||||||
|
sqlParameter.DbType = System.Data.DbType.DateTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sqlParameter.Value = parameter.Value;
|
sqlParameter.Value = parameter.Value;
|
||||||
sqlParameter.DbType = System.Data.DbType.Date;
|
sqlParameter.DbType = System.Data.DbType.Date;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (parameter.DbType == System.Data.DbType.AnsiStringFixedLength)
|
else if (parameter.DbType == System.Data.DbType.AnsiStringFixedLength)
|
||||||
{
|
{
|
||||||
sqlParameter.DbType = System.Data.DbType.AnsiStringFixedLength;
|
sqlParameter.DbType = System.Data.DbType.AnsiStringFixedLength;
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
<Compile Include="Abstract\SaveableProvider\StorageableDataTable.cs" />
|
<Compile Include="Abstract\SaveableProvider\StorageableDataTable.cs" />
|
||||||
<Compile Include="Abstract\SugarProvider\SqlSugarCoreProvider.cs" />
|
<Compile Include="Abstract\SugarProvider\SqlSugarCoreProvider.cs" />
|
||||||
<Compile Include="Entities\JoinMapper.cs" />
|
<Compile Include="Entities\JoinMapper.cs" />
|
||||||
|
<Compile Include="Enum\SugarActionType.cs" />
|
||||||
<Compile Include="Entities\SugarConnection.cs" />
|
<Compile Include="Entities\SugarConnection.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\SubTemplate.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\SubTemplate.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Subquery\SubqueryableN.cs" />
|
<Compile Include="ExpressionsToSql\Subquery\SubqueryableN.cs" />
|
||||||
|
@ -49,6 +49,7 @@ namespace SqlSugar
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Global variable
|
#region Global variable
|
||||||
|
public SugarActionType SugarActionType { get { return this.Context.SugarActionType; }set { this.Context.SugarActionType = value; } }
|
||||||
public SqlSugarProvider Context { get { return GetContext(); } }
|
public SqlSugarProvider Context { get { return GetContext(); } }
|
||||||
public bool IsSystemTablesConfig => this.Context.IsSystemTablesConfig;
|
public bool IsSystemTablesConfig => this.Context.IsSystemTablesConfig;
|
||||||
public ConnectionConfig CurrentConnectionConfig { get { return _CurrentConnectionConfig; } set { _CurrentConnectionConfig = value; } }
|
public ConnectionConfig CurrentConnectionConfig { get { return _CurrentConnectionConfig; } set { _CurrentConnectionConfig = value; } }
|
||||||
|
@ -35,7 +35,7 @@ namespace SqlSugar
|
|||||||
this._configAction = configAction;
|
this._configAction = configAction;
|
||||||
}
|
}
|
||||||
public SqlSugarClient ScopedContext{ get{ return GetContext();}}
|
public SqlSugarClient ScopedContext{ get{ return GetContext();}}
|
||||||
|
public SugarActionType SugarActionType { get => ScopedContext.SugarActionType;set=> ScopedContext.SugarActionType=value; }
|
||||||
public MappingTableList MappingTables { get => ScopedContext.MappingTables; set => ScopedContext.MappingTables = value; }
|
public MappingTableList MappingTables { get => ScopedContext.MappingTables; set => ScopedContext.MappingTables = value; }
|
||||||
public MappingColumnList MappingColumns { get => ScopedContext.MappingColumns; set => ScopedContext.MappingColumns=value; }
|
public MappingColumnList MappingColumns { get => ScopedContext.MappingColumns; set => ScopedContext.MappingColumns=value; }
|
||||||
public IgnoreColumnList IgnoreColumns { get => ScopedContext.IgnoreColumns; set => ScopedContext.IgnoreColumns=value; }
|
public IgnoreColumnList IgnoreColumns { get => ScopedContext.IgnoreColumns; set => ScopedContext.IgnoreColumns=value; }
|
||||||
|
Loading…
Reference in New Issue
Block a user