Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
6a0252c7b9
  1. 12
      SqlSugar/Abstract/AdoProvider/AdoAccessory.cs

12
SqlSugar/Abstract/AdoProvider/AdoAccessory.cs

@ -39,18 +39,18 @@ namespace SqlSugar
} }
protected virtual SugarParameter[] GetParameters(object obj, PropertyInfo[] propertyInfo,string sqlParameterKeyWord) protected virtual SugarParameter[] GetParameters(object whereObj, PropertyInfo[] propertyInfo,string sqlParameterKeyWord)
{ {
List<SugarParameter> listParams = new List<SugarParameter>(); List<SugarParameter> listParams = new List<SugarParameter>();
if (obj != null) if (whereObj != null)
{ {
var type = obj.GetType(); var type = whereObj.GetType();
var isDic = type.IsIn(PubConst.DicArraySO, PubConst.DicArraySS); var isDic = type.IsIn(PubConst.DicArraySO, PubConst.DicArraySS);
if (isDic) if (isDic)
{ {
if (type == PubConst.DicArraySO) if (type == PubConst.DicArraySO)
{ {
var newObj = (Dictionary<string, object>)obj; var newObj = (Dictionary<string, object>)whereObj;
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value)); var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
foreach (var par in pars) foreach (var par in pars)
{ {
@ -60,7 +60,7 @@ namespace SqlSugar
} }
else else
{ {
var newObj = (Dictionary<string, string>)obj; var newObj = (Dictionary<string, string>)whereObj;
var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value)); var pars = newObj.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value));
foreach (var par in pars) foreach (var par in pars)
{ {
@ -83,7 +83,7 @@ namespace SqlSugar
string replaceGuid = Guid.NewGuid().ToString(); string replaceGuid = Guid.NewGuid().ToString();
foreach (PropertyInfo r in propertiesObj) foreach (PropertyInfo r in propertiesObj)
{ {
var value = r.GetValue(obj, null); var value = r.GetValue(whereObj, null);
if (r.PropertyType.IsEnum) if (r.PropertyType.IsEnum)
{ {
value = Convert.ToInt64(value); value = Convert.ToInt64(value);

Loading…
Cancel
Save