Browse Source

4.5.9.2

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
36aeb875e9
  1. 16
      Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs
  2. 4
      Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs

16
Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs

@ -114,9 +114,9 @@ namespace SqlSugar
} }
else else
{ {
if (readerValues.ContainsKey(name)) if (readerValues.Any(it => it.Key.Equals(name, StringComparison.CurrentCultureIgnoreCase)))
{ {
var addValue = readerValues[name]; var addValue = readerValues.ContainsKey(name) ? readerValues[name] : readerValues[name.ToUpper()];
if (addValue == DBNull.Value) if (addValue == DBNull.Value)
{ {
if (item.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.DecType, UtilConstants.DobType, UtilConstants.ByteType)) if (item.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.DecType, UtilConstants.DobType, UtilConstants.ByteType))
@ -296,23 +296,23 @@ namespace SqlSugar
{ {
if (models.IsNullOrEmpty()) return new KeyValuePair<string, SugarParameter[]>(); if (models.IsNullOrEmpty()) return new KeyValuePair<string, SugarParameter[]>();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
List<SugarParameter> parameters = new List<SugarParameter>() ; List<SugarParameter> parameters = new List<SugarParameter>();
var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig); var sqlBuilder = InstanceFactory.GetSqlbuilder(this.Context.CurrentConnectionConfig);
foreach (var item in models) foreach (var item in models)
{ {
var index = models.IndexOf(item); var index = models.IndexOf(item);
var type = index == 0?"":"AND"; var type = index == 0 ? "" : "AND";
string temp = " {0} {1} {2} {3} "; string temp = " {0} {1} {2} {3} ";
string parameterName = string.Format("{0}Conditional{1}{2}",sqlBuilder.SqlParameterKeyWord,item.FieldName,index); string parameterName = string.Format("{0}Conditional{1}{2}", sqlBuilder.SqlParameterKeyWord, item.FieldName, index);
switch (item.ConditionalType) switch (item.ConditionalType)
{ {
case ConditionalType.Equal: case ConditionalType.Equal:
builder.AppendFormat(temp,type,item.FieldName.ToSqlFilter(),"=", parameterName); builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "=", parameterName);
parameters.Add(new SugarParameter(parameterName,item.FieldValue)); parameters.Add(new SugarParameter(parameterName, item.FieldValue));
break; break;
case ConditionalType.Like: case ConditionalType.Like:
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "LIKE", parameterName); builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), "LIKE", parameterName);
parameters.Add(new SugarParameter(parameterName, "%"+item.FieldValue+"%")); parameters.Add(new SugarParameter(parameterName, "%" + item.FieldValue + "%"));
break; break;
case ConditionalType.GreaterThan: case ConditionalType.GreaterThan:
builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), ">", parameterName); builder.AppendFormat(temp, type, item.FieldName.ToSqlFilter(), ">", parameterName);

4
Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.5.9.1")] [assembly: AssemblyVersion("4.5.9.2")]
[assembly: AssemblyFileVersion("4.5.9.1")] [assembly: AssemblyFileVersion("4.5.9.2")]

Loading…
Cancel
Save