mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-19 06: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 entityPropertyName = this.Context.EntityMaintenance.GetPropertyName<T>(primaryField);
|
||||||
var columnInfo = EntityInfo.Columns.Single(it => it.PropertyName.Equals(entityPropertyName, StringComparison.CurrentCultureIgnoreCase));
|
var columnInfo = EntityInfo.Columns.Single(it => it.PropertyName.Equals(entityPropertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||||
var value = columnInfo.PropertyInfo.GetValue(deleteObj, null);
|
var value = columnInfo.PropertyInfo.GetValue(deleteObj, null);
|
||||||
|
value = UtilMethods.GetConvertValue(value);
|
||||||
primaryKeyValues.Add(value);
|
primaryKeyValues.Add(value);
|
||||||
}
|
}
|
||||||
if (primaryKeyValues.Count < 10000)
|
if (primaryKeyValues.Count < 10000)
|
||||||
@ -168,6 +169,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
else
|
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);
|
andString.AppendFormat(tempequals, primaryField, entityValue);
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
@ -179,7 +185,6 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDeleteable<T> Where(Expression<Func<T, bool>> expression)
|
public IDeleteable<T> Where(Expression<Func<T, bool>> expression)
|
||||||
{
|
{
|
||||||
var expResult = DeleteBuilder.GetExpressionValue(expression, ResolveExpressType.WhereSingle);
|
var expResult = DeleteBuilder.GetExpressionValue(expression, ResolveExpressType.WhereSingle);
|
||||||
|
@ -221,6 +221,15 @@ namespace SqlSugar
|
|||||||
return info;
|
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)
|
internal static T To<T>(object value)
|
||||||
{
|
{
|
||||||
return (T)To(value, typeof(T));
|
return (T)To(value, typeof(T));
|
||||||
|
Loading…
Reference in New Issue
Block a user