mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-17 05:29:33 +08:00
Update DeleteableProvider
This commit is contained in:
parent
7e8c0576d3
commit
8537343a77
@ -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);
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user