Update .net core project

This commit is contained in:
sunkaixuan
2022-08-25 13:15:06 +08:00
parent 87266dff16
commit 9f8c97685e
4 changed files with 23 additions and 1 deletions

View File

@@ -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);
}
}
}
}

View File

@@ -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);

View File

@@ -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())
{

View File

@@ -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));