mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
Merge branch 'master' of https://gitee.com/sunkaixuan/sqlsugar_orm_4-0
This commit is contained in:
@@ -8,6 +8,6 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "Data Source=SUNKAIXUAN.htinns.loc/ORCL;User ID=system;Password=manager;";
|
||||
public static string ConnectionString = "Data Source=localhost/orcl;User ID=system;Password=JHL52771jhl;";
|
||||
}
|
||||
}
|
||||
|
@@ -8,8 +8,8 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SqlSugar4XTest";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtest";
|
||||
public static string ConnectionString = "server=.;uid=sa;pwd=sasa;database=SqlSugar4XTest";
|
||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=sasa;database=SQLSUGAR4XTEST";
|
||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=sasa;database=sqlsugar4xtest";
|
||||
}
|
||||
}
|
||||
|
@@ -1217,6 +1217,7 @@ namespace SqlSugar
|
||||
asyncQueryableBuilder.GroupByValue = this.QueryBuilder.GroupByValue;
|
||||
asyncQueryableBuilder.OrderByValue = this.QueryBuilder.OrderByValue;
|
||||
asyncQueryableBuilder.IsDisabledGobalFilter = this.QueryBuilder.IsDisabledGobalFilter;
|
||||
asyncQueryableBuilder.PartitionByValue = this.QueryBuilder.PartitionByValue;
|
||||
return asyncQueryable;
|
||||
}
|
||||
#endregion
|
||||
|
@@ -76,6 +76,15 @@ namespace SqlSugar
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false)
|
||||
{
|
||||
UpdateBuilder.IsOffIdentity = isOffIdentity;
|
||||
if (this.UpdateBuilder.LambdaExpressions == null)
|
||||
this.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.Context.CurrentConnectionConfig);
|
||||
this.UpdateBuilder.IsNoUpdateNull = ignoreAllNullColumns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns)
|
||||
{
|
||||
var ignoreColumns = UpdateBuilder.GetExpressionValue(columns, ResolveExpressType.ArraySingle).GetResultArray().Select(it => this.SqlBuilder.GetNoTranslationColumnName(it)).ToList();
|
||||
@@ -183,6 +192,7 @@ namespace SqlSugar
|
||||
this.UpdateBuilder.DbColumnInfoList = this.UpdateBuilder.DbColumnInfoList.Where(it => UpdateBuilder.SetValues.Any(v => SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.DbColumnName,StringComparison.CurrentCultureIgnoreCase)|| SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.PropertyName,StringComparison.CurrentCultureIgnoreCase)) || it.IsPrimarykey == true).ToList();
|
||||
return this;
|
||||
}
|
||||
[Obsolete("Use IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);")]
|
||||
|
||||
public IUpdateable<T> Where(bool isUpdateNull, bool IsOffIdentity = false)
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@ namespace SqlSugar
|
||||
Task<bool> ExecuteCommandHasChangeAsync();
|
||||
IUpdateable<T> AS(string tableName);
|
||||
IUpdateable<T> With(string lockString);
|
||||
[Obsolete("Use IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);")]
|
||||
IUpdateable<T> Where(bool isNoUpdateNull,bool IsOffIdentity = false);
|
||||
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
||||
IUpdateable<T> Where(string whereSql,object parameters=null);
|
||||
@@ -37,6 +38,7 @@ namespace SqlSugar
|
||||
IUpdateable<T> UpdateColumns(Expression<Func<T, bool>> columns);
|
||||
IUpdateable<T> UpdateColumns(Func<string, bool> updateColumMethod);
|
||||
IUpdateable<T> UpdateColumns(Expression<Func<T, T>> columns);
|
||||
IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);
|
||||
IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns);
|
||||
IUpdateable<T> IgnoreColumns(Func<string, bool> ignoreColumMethod);
|
||||
IUpdateable<T> ReSetValue(Expression<Func<T, bool>> setValueExpression);
|
||||
|
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("4.6.4.9")]
|
||||
[assembly: AssemblyFileVersion("4.6.4.9")]
|
||||
[assembly: AssemblyVersion("4.7")]
|
||||
[assembly: AssemblyFileVersion("4.7")]
|
||||
|
@@ -111,7 +111,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
|
@@ -60,7 +60,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
|
@@ -157,7 +157,7 @@ namespace SqlSugar
|
||||
var parameter = model.Args[0].MemberName;
|
||||
var parameter2 = model.Args[1].MemberName;
|
||||
int time = 1;
|
||||
return string.Format(" Cast((JulianDay({0}) - JulianDay({1})) *{2} As INTEGER)", parameter, parameter2, time);
|
||||
return string.Format(" Cast((JulianDay({0}) - JulianDay({1})) *{2} As INTEGER)=0 ", parameter, parameter2, time);
|
||||
}
|
||||
public override string DateIsSameByType(MethodCallExpressionModel model)
|
||||
{
|
||||
|
@@ -8,6 +8,6 @@ namespace OrmTest
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
public static string ConnectionString = @"DataSource=D:\MyGit\SqlSugar\Src\Asp.Net\SqliteTest\DataBase\SqlSugar4xTest.sqlite";
|
||||
public static string ConnectionString = @"DataSource=F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\Src\Asp.Net\SqliteTest\DataBase\SqlSugar4xTest.sqlite";
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@@ -356,7 +356,7 @@ namespace OrmTest.UnitTest
|
||||
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, " Cast((JulianDay(@MethodConst0) - JulianDay(@MethodConst1)) *1 As INTEGER)", new List<SugarParameter>() {
|
||||
base.Check(value, pars, " Cast((JulianDay(@MethodConst0) - JulianDay(@MethodConst1)) *1 As INTEGER)=0 ", new List<SugarParameter>() {
|
||||
new SugarParameter("@MethodConst0",x2),new SugarParameter("@MethodConst1",x2)
|
||||
}, "DateIsSameDay error");
|
||||
}
|
||||
|
@@ -194,6 +194,17 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Task<DbResult<bool>> UseTranAsync(Action action)
|
||||
{
|
||||
Task<DbResult<bool>> result = new Task<DbResult<bool>>(() =>
|
||||
{
|
||||
return UseTran(action);
|
||||
});
|
||||
TaskStart(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public DbResult<T> UseTran<T>(Func<T> action)
|
||||
{
|
||||
var result = new DbResult<T>();
|
||||
@@ -214,6 +225,17 @@ namespace SqlSugar
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Task<DbResult<T>> UseTranAsync<T>(Func<T> action)
|
||||
{
|
||||
Task<DbResult<T>> result = new Task<DbResult<T>>(() =>
|
||||
{
|
||||
return UseTran(action);
|
||||
});
|
||||
TaskStart(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void UseStoredProcedure(Action action)
|
||||
{
|
||||
var oldCommandType = this.CommandType;
|
||||
@@ -624,6 +646,14 @@ namespace SqlSugar
|
||||
#endregion
|
||||
|
||||
#region Helper
|
||||
private void TaskStart<Type>(Task<Type> result)
|
||||
{
|
||||
if (this.Context.CurrentConnectionConfig.IsShardSameThread)
|
||||
{
|
||||
Check.Exception(true, "IsShardSameThread=true can't be used async method");
|
||||
}
|
||||
result.Start();
|
||||
}
|
||||
private void ExecuteProcessingSQL(ref string sql, SugarParameter[] parameters)
|
||||
{
|
||||
var result = this.ProcessingEventStartingSQL(sql, parameters);
|
||||
|
@@ -62,6 +62,10 @@ namespace SqlSugar
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
if (this.Context.MappingTables.Any(it => it.EntityName == entityName))
|
||||
{
|
||||
this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
||||
}
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
return this; ;
|
||||
}
|
||||
|
@@ -145,6 +145,10 @@ namespace SqlSugar
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
if (this.Context.MappingTables.Any(it => it.EntityName == entityName))
|
||||
{
|
||||
this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
||||
}
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
return this; ;
|
||||
}
|
||||
|
@@ -628,7 +628,7 @@ namespace SqlSugar
|
||||
}
|
||||
public ISugarQueryable<T> WithCacheIF(bool isCache, int cacheDurationInSeconds = int.MaxValue)
|
||||
{
|
||||
if (IsCache)
|
||||
if (isCache)
|
||||
{
|
||||
this.IsCache = true;
|
||||
this.CacheTime = cacheDurationInSeconds;
|
||||
@@ -1019,6 +1019,10 @@ namespace SqlSugar
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
if (this.Context.MappingTables.Any(it => it.EntityName == entityName))
|
||||
{
|
||||
this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
||||
}
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
this.QueryableMappingTableList = this.Context.MappingTables;
|
||||
return this;
|
||||
@@ -1212,6 +1216,8 @@ namespace SqlSugar
|
||||
asyncQueryableBuilder.TableWithString = this.QueryBuilder.TableWithString;
|
||||
asyncQueryableBuilder.GroupByValue = this.QueryBuilder.GroupByValue;
|
||||
asyncQueryableBuilder.OrderByValue = this.QueryBuilder.OrderByValue;
|
||||
asyncQueryableBuilder.IsDisabledGobalFilter = this.QueryBuilder.IsDisabledGobalFilter;
|
||||
asyncQueryableBuilder.PartitionByValue = this.QueryBuilder.PartitionByValue;
|
||||
return asyncQueryable;
|
||||
}
|
||||
#endregion
|
||||
|
@@ -169,7 +169,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
|
@@ -262,7 +262,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
|
@@ -64,25 +64,27 @@ namespace SqlSugar
|
||||
IsAs = true;
|
||||
OldMappingTableList = this.Context.MappingTables;
|
||||
this.Context.MappingTables = this.Context.Utilities.TranslateCopy(this.Context.MappingTables);
|
||||
if (this.Context.MappingTables.Any(it => it.EntityName == entityName)) {
|
||||
this.Context.MappingTables.Add(this.Context.MappingTables.First(it => it.EntityName == entityName).DbTableName, tableName);
|
||||
}
|
||||
this.Context.MappingTables.Add(entityName, tableName);
|
||||
return this; ;
|
||||
}
|
||||
|
||||
public IUpdateable<T> IgnoreColumns(bool IgnoreAllNullColumns, bool IsOffIdentity = false)
|
||||
{
|
||||
UpdateBuilder.IsOffIdentity = IsOffIdentity;
|
||||
if (this.UpdateBuilder.LambdaExpressions == null)
|
||||
this.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.Context.CurrentConnectionConfig);
|
||||
this.UpdateBuilder.IsNoUpdateNull = IgnoreAllNullColumns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> IgnoreColumns(Func<string, bool> ignoreColumMethod)
|
||||
{
|
||||
this.UpdateBuilder.DbColumnInfoList = this.UpdateBuilder.DbColumnInfoList.Where(it => !ignoreColumMethod(it.PropertyName)).ToList();
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false)
|
||||
{
|
||||
UpdateBuilder.IsOffIdentity = isOffIdentity;
|
||||
if (this.UpdateBuilder.LambdaExpressions == null)
|
||||
this.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.Context.CurrentConnectionConfig);
|
||||
this.UpdateBuilder.IsNoUpdateNull = ignoreAllNullColumns;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns)
|
||||
{
|
||||
var ignoreColumns = UpdateBuilder.GetExpressionValue(columns, ResolveExpressType.ArraySingle).GetResultArray().Select(it => this.SqlBuilder.GetNoTranslationColumnName(it)).ToList();
|
||||
@@ -190,8 +192,8 @@ namespace SqlSugar
|
||||
this.UpdateBuilder.DbColumnInfoList = this.UpdateBuilder.DbColumnInfoList.Where(it => UpdateBuilder.SetValues.Any(v => SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.DbColumnName,StringComparison.CurrentCultureIgnoreCase)|| SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.PropertyName,StringComparison.CurrentCultureIgnoreCase)) || it.IsPrimarykey == true).ToList();
|
||||
return this;
|
||||
}
|
||||
[Obsolete("Use IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);")]
|
||||
|
||||
[Obsolete]
|
||||
public IUpdateable<T> Where(bool isUpdateNull, bool IsOffIdentity = false)
|
||||
{
|
||||
UpdateBuilder.IsOffIdentity = IsOffIdentity;
|
||||
@@ -200,7 +202,6 @@ namespace SqlSugar
|
||||
this.UpdateBuilder.IsNoUpdateNull = isUpdateNull;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IUpdateable<T> Where(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
var expResult = UpdateBuilder.GetExpressionValue(expression, ResolveExpressType.WhereSingle);
|
||||
@@ -294,6 +295,7 @@ namespace SqlSugar
|
||||
{
|
||||
foreach (var column in EntityInfo.Columns)
|
||||
{
|
||||
if (column.IsIgnore) continue;
|
||||
var columnInfo = new DbColumnInfo()
|
||||
{
|
||||
Value = column.PropertyInfo.GetValue(item, null),
|
||||
|
@@ -325,6 +325,11 @@ namespace SqlSugar
|
||||
return "GETDATE()";
|
||||
}
|
||||
|
||||
public virtual string GetRandom()
|
||||
{
|
||||
return "NEWID()";
|
||||
}
|
||||
|
||||
public virtual string CaseWhen(List<KeyValuePair<string, string>> sqls)
|
||||
{
|
||||
StringBuilder reslut = new StringBuilder();
|
||||
|
@@ -59,5 +59,6 @@ namespace SqlSugar
|
||||
string Pack(string sql);
|
||||
string Null();
|
||||
string GetDate();
|
||||
string GetRandom();
|
||||
}
|
||||
}
|
||||
|
@@ -110,6 +110,7 @@ namespace SqlSugar
|
||||
/// <returns></returns>
|
||||
public static TResult GetSelfAndAutoFill<TResult>(TResult value) { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static DateTime GetDate() { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
public static string GetRandom() { throw new NotSupportedException("Can only be used in expressions"); }
|
||||
/// <summary>
|
||||
/// Subquery
|
||||
/// </summary>
|
||||
|
@@ -504,6 +504,8 @@ namespace SqlSugar
|
||||
return this.Context.DbMehtods.GetSelfAndAutoFill(model.Args[0].MemberValue.ObjToString(), this.Context.IsSingle);
|
||||
case "GetDate":
|
||||
return this.Context.DbMehtods.GetDate();
|
||||
case "GetRandom":
|
||||
return this.Context.DbMehtods.GetRandom();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ namespace SqlSugar
|
||||
{
|
||||
var exp = expression as MethodCallExpression;
|
||||
var argExp= exp.Arguments[0];
|
||||
var result= "WHERE "+SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);
|
||||
var result= "WHERE "+SubTools.GetMethodValue(Context, argExp, ResolveExpressType.WhereMultiple);;
|
||||
var selfParameterName = Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name)+UtilConstants.Dot;
|
||||
result = result.Replace(selfParameterName,string.Empty);
|
||||
return result;
|
||||
|
@@ -278,6 +278,7 @@ namespace SqlSugar
|
||||
newClient.Ado.LogEventStarting = Context.Ado.LogEventStarting;
|
||||
newClient.Ado.LogEventCompleted = Context.Ado.LogEventCompleted;
|
||||
newClient.Ado.ProcessingEventStartingSQL = Context.Ado.ProcessingEventStartingSQL;
|
||||
newClient.QueryFilter = Context.QueryFilter;
|
||||
}
|
||||
return newClient;
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ namespace SqlSugar
|
||||
{
|
||||
get
|
||||
{
|
||||
var result = _Context;
|
||||
var result = _Context; ;
|
||||
if (CurrentConnectionConfig.IsShardSameThread)
|
||||
{
|
||||
if (CallContext.ContextList.Value.IsNullOrEmpty())
|
||||
@@ -268,7 +268,7 @@ namespace SqlSugar
|
||||
protected InsertableProvider<T> CreateInsertable<T>(T[] insertObjs) where T : class, new()
|
||||
{
|
||||
var result = InstanceFactory.GetInsertableProvider<T>(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||
result.Context = this.Context;
|
||||
result.EntityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>();
|
||||
result.SqlBuilder = sqlBuilder;
|
||||
@@ -283,7 +283,7 @@ namespace SqlSugar
|
||||
protected DeleteableProvider<T> CreateDeleteable<T>() where T : class, new()
|
||||
{
|
||||
var result = InstanceFactory.GetDeleteableProvider<T>(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||
result.Context = this.Context;
|
||||
result.SqlBuilder = sqlBuilder;
|
||||
sqlBuilder.DeleteBuilder = result.DeleteBuilder = InstanceFactory.GetDeleteBuilder(this.CurrentConnectionConfig);
|
||||
@@ -295,7 +295,7 @@ namespace SqlSugar
|
||||
protected UpdateableProvider<T> CreateUpdateable<T>(T[] UpdateObjs) where T : class, new()
|
||||
{
|
||||
var result = InstanceFactory.GetUpdateableProvider<T>(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig);
|
||||
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.CurrentConnectionConfig); ;
|
||||
result.Context = this.Context;
|
||||
result.EntityInfo = this.Context.EntityMaintenance.GetEntityInfo<T>();
|
||||
result.SqlBuilder = sqlBuilder;
|
||||
@@ -400,7 +400,7 @@ namespace SqlSugar
|
||||
result.Add(joinValue);
|
||||
}
|
||||
}
|
||||
return result.ToArray();
|
||||
return result.ToArray(); ;
|
||||
}
|
||||
|
||||
protected Dictionary<string, string> GetEasyJoinInfo(Expression joinExpression, ref string shortName, ISqlBuilder builder, params Type[] entityTypeArray)
|
||||
|
@@ -86,6 +86,9 @@ namespace SqlSugar
|
||||
|
||||
DbResult<bool> UseTran(Action action);
|
||||
DbResult<T> UseTran<T>(Func<T> action);
|
||||
Task<DbResult<bool>> UseTranAsync(Action action);
|
||||
Task<DbResult<T>> UseTranAsync<T>(Func<T> action);
|
||||
|
||||
void UseStoredProcedure(Action action);
|
||||
T UseStoredProcedure<T>(Func<T> action);
|
||||
IAdo UseStoredProcedure();
|
||||
|
@@ -16,7 +16,7 @@ namespace SqlSugar
|
||||
Task<bool> ExecuteCommandHasChangeAsync();
|
||||
IUpdateable<T> AS(string tableName);
|
||||
IUpdateable<T> With(string lockString);
|
||||
[Obsolete]
|
||||
[Obsolete("Use IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);")]
|
||||
IUpdateable<T> Where(bool isNoUpdateNull,bool IsOffIdentity = false);
|
||||
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
||||
IUpdateable<T> Where(string whereSql,object parameters=null);
|
||||
@@ -33,12 +33,12 @@ namespace SqlSugar
|
||||
/// </summary>
|
||||
/// <param name="columns"></param>
|
||||
/// <returns></returns>
|
||||
IUpdateable<T> IgnoreColumns(bool IgnoreAllNullColumns, bool IsOffIdentity = false);
|
||||
IUpdateable<T> WhereColumns(Expression<Func<T, object>> columns);
|
||||
IUpdateable<T> UpdateColumns(Expression<Func<T, object>> columns);
|
||||
IUpdateable<T> UpdateColumns(Expression<Func<T, bool>> columns);
|
||||
IUpdateable<T> UpdateColumns(Func<string, bool> updateColumMethod);
|
||||
IUpdateable<T> UpdateColumns(Expression<Func<T, T>> columns);
|
||||
IUpdateable<T> IgnoreColumns(bool ignoreAllNullColumns, bool isOffIdentity = false);
|
||||
IUpdateable<T> IgnoreColumns(Expression<Func<T, object>> columns);
|
||||
IUpdateable<T> IgnoreColumns(Func<string, bool> ignoreColumMethod);
|
||||
IUpdateable<T> ReSetValue(Expression<Func<T, bool>> setValueExpression);
|
||||
|
@@ -133,5 +133,10 @@ namespace SqlSugar
|
||||
{
|
||||
return "NOW()";
|
||||
}
|
||||
|
||||
public override string GetRandom()
|
||||
{
|
||||
return "rand()";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -180,5 +180,10 @@ namespace SqlSugar
|
||||
{
|
||||
return "sysdate";
|
||||
}
|
||||
|
||||
public override string GetRandom()
|
||||
{
|
||||
return "dbms_random.value";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -111,7 +111,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
|
@@ -60,7 +60,7 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value);
|
||||
string bytesString = "0x" + BitConverter.ToString((byte[])value).Replace("-", "");
|
||||
return bytesString;
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
|
@@ -157,7 +157,7 @@ namespace SqlSugar
|
||||
var parameter = model.Args[0].MemberName;
|
||||
var parameter2 = model.Args[1].MemberName;
|
||||
int time = 1;
|
||||
return string.Format(" Cast((JulianDay({0}) - JulianDay({1})) *{2} As INTEGER)", parameter, parameter2, time);
|
||||
return string.Format(" Cast((JulianDay({0}) - JulianDay({1})) *{2} As INTEGER)=0 ", parameter, parameter2, time);
|
||||
}
|
||||
public override string DateIsSameByType(MethodCallExpressionModel model)
|
||||
{
|
||||
@@ -208,5 +208,10 @@ namespace SqlSugar
|
||||
{
|
||||
return "DATETIME('now')";
|
||||
}
|
||||
|
||||
public override string GetRandom()
|
||||
{
|
||||
return "RANDOM()";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Version>4.6.4.9</Version>
|
||||
<Version>4.7</Version>
|
||||
<Copyright>sun_kai_xuan</Copyright>
|
||||
<PackageProjectUrl>https://github.com/sunkaixuan/SqlSugar</PackageProjectUrl>
|
||||
<PackageLicenseUrl></PackageLicenseUrl>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<package >
|
||||
<metadata>
|
||||
<id>sqlSugarCore</id>
|
||||
<version>4.6.4.7</version>
|
||||
<version>4.7</version>
|
||||
<authors>sunkaixuan</authors>
|
||||
<owners>Landa</owners>
|
||||
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>
|
||||
|
Reference in New Issue
Block a user