mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Update .net core project
This commit is contained in:
@@ -1528,6 +1528,12 @@ namespace SqlSugar
|
||||
item.Value = DBNull.Value;
|
||||
}
|
||||
}
|
||||
if (item.ParameterName != null && item.ParameterName.Contains(" "))
|
||||
{
|
||||
var oldName = item.ParameterName;
|
||||
item.ParameterName = item.ParameterName.Replace(" ", "");
|
||||
sql = sql.Replace(oldName, item.ParameterName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -107,6 +107,7 @@ namespace SqlSugar
|
||||
var entityPropertyName = this.Context.EntityMaintenance.GetPropertyName<T>(primaryField);
|
||||
var columnInfo = EntityInfo.Columns.Single(it => it.PropertyName.Equals(entityPropertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
var value = columnInfo.PropertyInfo.GetValue(deleteObj, null);
|
||||
value = UtilMethods.GetConvertValue(value);
|
||||
primaryKeyValues.Add(value);
|
||||
}
|
||||
if (primaryKeyValues.Count < 10000)
|
||||
@@ -168,6 +169,11 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((columnInfo.SqlParameterDbType.ObjToString()==System.Data.DbType.AnsiString.ObjToString()) ||!(entityValue is string)||this.Context.CurrentConnectionConfig?.MoreSettings?.DisableNvarchar==true)
|
||||
{
|
||||
tempequals = tempequals.Replace("=N'", "='");
|
||||
}
|
||||
entityValue = UtilMethods.GetConvertValue(entityValue);
|
||||
andString.AppendFormat(tempequals, primaryField, entityValue);
|
||||
}
|
||||
++i;
|
||||
@@ -179,7 +185,6 @@ namespace SqlSugar
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public IDeleteable<T> Where(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
var expResult = DeleteBuilder.GetExpressionValue(expression, ResolveExpressType.WhereSingle);
|
||||
|
@@ -100,12 +100,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (method.Method.Name == "Where")
|
||||
{
|
||||
this._Context.InitMappingInfo<T>();
|
||||
navigatManager.CheckHasRootShortName(method.Arguments[0], method.Arguments[1]);
|
||||
var exp = method.Arguments[1];
|
||||
_WhereList.Add(" " + queryBuilder.GetExpressionValue(exp, ResolveExpressType.WhereSingle).GetString());
|
||||
}
|
||||
else if (method.Method.Name == "WhereIF")
|
||||
{
|
||||
this._Context.InitMappingInfo<T>();
|
||||
var isOk = LambdaExpression.Lambda(method.Arguments[1]).Compile().DynamicInvoke();
|
||||
if (isOk.ObjToBool())
|
||||
{
|
||||
|
@@ -221,6 +221,15 @@ namespace SqlSugar
|
||||
return info;
|
||||
}
|
||||
|
||||
internal static object GetConvertValue(object entityValue)
|
||||
{
|
||||
if (entityValue != null && entityValue is DateTime)
|
||||
{
|
||||
entityValue = entityValue.ObjToDate().ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
}
|
||||
return entityValue;
|
||||
}
|
||||
|
||||
internal static T To<T>(object value)
|
||||
{
|
||||
return (T)To(value, typeof(T));
|
||||
|
Reference in New Issue
Block a user