mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-03 04:13:48 +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.Context.CurrentConnectionConfig.ConnectionString = this.MasterConnectionString;
|
||||
}
|
||||
this.Context.SugarActionType = SugarActionType.UnKnown;
|
||||
}
|
||||
|
||||
private bool IsRead(string sql)
|
||||
|
@ -31,6 +31,7 @@ namespace SqlSugar
|
||||
public MappingColumnList MappingColumns { get; set; }
|
||||
public IgnoreColumnList IgnoreColumns { get; set; }
|
||||
public IgnoreColumnList IgnoreInsertColumns { get; set; }
|
||||
public SugarActionType SugarActionType { get; set; } = SugarActionType.UnKnown;
|
||||
public ConfigQuery ConfigQuery {
|
||||
get
|
||||
{
|
||||
@ -258,6 +259,7 @@ namespace SqlSugar
|
||||
}
|
||||
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);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(CurrentConnectionConfig);
|
||||
result.Context = this.Context;
|
||||
@ -272,6 +274,7 @@ namespace SqlSugar
|
||||
}
|
||||
protected InsertableProvider<T> CreateInsertable<T>(T[] insertObjs) where T : class, new()
|
||||
{
|
||||
this.SugarActionType = SugarActionType.Insert;
|
||||
var result = InstanceFactory.GetInsertableProvider<T>(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||
result.Context = this;
|
||||
@ -287,6 +290,7 @@ namespace SqlSugar
|
||||
}
|
||||
protected DeleteableProvider<T> CreateDeleteable<T>() where T : class, new()
|
||||
{
|
||||
this.SugarActionType = SugarActionType.Delete;
|
||||
var result = InstanceFactory.GetDeleteableProvider<T>(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||
result.Context = this;
|
||||
@ -299,6 +303,7 @@ namespace SqlSugar
|
||||
}
|
||||
protected UpdateableProvider<T> CreateUpdateable<T>(T[] UpdateObjs) where T : class, new()
|
||||
{
|
||||
this.SugarActionType = SugarActionType.Update;
|
||||
var result = InstanceFactory.GetUpdateableProvider<T>(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||
result.Context = this;
|
||||
@ -315,6 +320,7 @@ namespace SqlSugar
|
||||
|
||||
protected void CreateQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
||||
{
|
||||
this.SugarActionType = SugarActionType.Query;
|
||||
this.CreateQueryable<T>(queryable);
|
||||
string shortName = string.Empty;
|
||||
List<SugarParameter> paramters = new List<SugarParameter>();
|
||||
@ -328,6 +334,7 @@ namespace SqlSugar
|
||||
}
|
||||
protected void CreateEasyQueryJoin<T>(Expression joinExpression, Type[] types, ISugarQueryable<T> queryable)
|
||||
{
|
||||
this.SugarActionType = SugarActionType.Query;
|
||||
this.CreateQueryable<T>(queryable);
|
||||
string shortName = string.Empty;
|
||||
queryable.SqlBuilder.QueryBuilder.EasyJoinInfos = this.GetEasyJoinInfo(joinExpression, ref shortName, queryable.SqlBuilder, types);
|
||||
|
@ -1199,7 +1199,8 @@ namespace SqlSugar
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region
|
||||
|
||||
#region Fastest
|
||||
public IFastest<T> Fastest<T>() where T:class,new()
|
||||
{
|
||||
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; }
|
||||
QueryFilterProvider QueryFilter { get; set; }
|
||||
IContextMethods Utilities { get; set; }
|
||||
|
||||
SugarActionType SugarActionType { get; set; }
|
||||
|
||||
#region Deleteable
|
||||
IDeleteable<T> Deleteable<T>() where T : class, new();
|
||||
|
@ -164,8 +164,16 @@ namespace SqlSugar
|
||||
}
|
||||
else if (parameter.DbType == System.Data.DbType.DateTime)
|
||||
{
|
||||
sqlParameter.Value = parameter.Value;
|
||||
sqlParameter.DbType = System.Data.DbType.Date;
|
||||
if (this.Context.SugarActionType == SugarActionType.Insert)
|
||||
{
|
||||
sqlParameter.Value = parameter.Value;
|
||||
sqlParameter.DbType = System.Data.DbType.DateTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlParameter.Value = parameter.Value;
|
||||
sqlParameter.DbType = System.Data.DbType.Date;
|
||||
}
|
||||
}
|
||||
else if (parameter.DbType == System.Data.DbType.AnsiStringFixedLength)
|
||||
{
|
||||
|
@ -97,6 +97,7 @@
|
||||
<Compile Include="Abstract\SaveableProvider\StorageableDataTable.cs" />
|
||||
<Compile Include="Abstract\SugarProvider\SqlSugarCoreProvider.cs" />
|
||||
<Compile Include="Entities\JoinMapper.cs" />
|
||||
<Compile Include="Enum\SugarActionType.cs" />
|
||||
<Compile Include="Entities\SugarConnection.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\SubTemplate.cs" />
|
||||
<Compile Include="ExpressionsToSql\Subquery\SubqueryableN.cs" />
|
||||
|
@ -49,6 +49,7 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Global variable
|
||||
public SugarActionType SugarActionType { get { return this.Context.SugarActionType; }set { this.Context.SugarActionType = value; } }
|
||||
public SqlSugarProvider Context { get { return GetContext(); } }
|
||||
public bool IsSystemTablesConfig => this.Context.IsSystemTablesConfig;
|
||||
public ConnectionConfig CurrentConnectionConfig { get { return _CurrentConnectionConfig; } set { _CurrentConnectionConfig = value; } }
|
||||
|
@ -35,7 +35,7 @@ namespace SqlSugar
|
||||
this._configAction = configAction;
|
||||
}
|
||||
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 MappingColumnList MappingColumns { get => ScopedContext.MappingColumns; set => ScopedContext.MappingColumns=value; }
|
||||
public IgnoreColumnList IgnoreColumns { get => ScopedContext.IgnoreColumns; set => ScopedContext.IgnoreColumns=value; }
|
||||
|
Loading…
Reference in New Issue
Block a user