diff --git a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs index 729bcb577..e090a8c0f 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs @@ -22,7 +22,7 @@ namespace SqlSugar if (parameters != null) { var entityType = parameters.GetType(); - var isDictionary = entityType.IsIn(PubConst.DicArraySO, PubConst.DicArraySS); + var isDictionary = entityType.IsIn(UtilConstants.DicArraySO, UtilConstants.DicArraySS); if (isDictionary) { DictionaryToParameters(parameters, sqlParameterKeyWord, result, entityType); @@ -69,7 +69,7 @@ namespace SqlSugar } protected void DictionaryToParameters(object parameters, string sqlParameterKeyWord, List listParams, Type entityType) { - if (entityType == PubConst.DicArraySO) + if (entityType == UtilConstants.DicArraySO) { var dictionaryParameters = (Dictionary)parameters; var sugarParameters = dictionaryParameters.Select(it => new SugarParameter(sqlParameterKeyWord + it.Key, it.Value)); diff --git a/Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs index df5da6aaf..326251d4b 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs @@ -115,7 +115,7 @@ namespace SqlSugar .Where(ec => !dbColumns.Any(dc => dc.DbColumnName.Equals(ec.OldDbColumnName, StringComparison.CurrentCultureIgnoreCase))) .Where(ec => dbColumns.Any(dc => dc.DbColumnName.Equals(ec.DbColumnName) - && ((ec.Length != dc.Length && !PubMethod.GetUnderType(ec.PropertyInfo).IsEnum() && PubMethod.GetUnderType(ec.PropertyInfo).IsIn(PubConst.StringType)) || + && ((ec.Length != dc.Length && !PubMethod.GetUnderType(ec.PropertyInfo).IsEnum() && PubMethod.GetUnderType(ec.PropertyInfo).IsIn(UtilConstants.StringType)) || ec.IsNullable != dc.IsNullable || IsSamgeType(ec, dc)))).ToList(); var renameColumns = entityColumns @@ -231,7 +231,7 @@ namespace SqlSugar } else if (propertyType.IsEnum()) { - result.DataType = this.Context.Ado.DbBind.GetDbTypeName(item.Length > 9 ? PubConst.LongType.Name : PubConst.IntType.Name); + result.DataType = this.Context.Ado.DbBind.GetDbTypeName(item.Length > 9 ? UtilConstants.LongType.Name : UtilConstants.IntType.Name); } else { @@ -250,7 +250,7 @@ namespace SqlSugar var properyTypeName = string.Empty; if (propertyType.IsEnum()) { - properyTypeName = this.Context.Ado.DbBind.GetDbTypeName(ec.Length > 9 ? PubConst.LongType.Name : PubConst.IntType.Name); + properyTypeName = this.Context.Ado.DbBind.GetDbTypeName(ec.Length > 9 ? UtilConstants.LongType.Name : UtilConstants.IntType.Name); } else { diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs index 6cb1a8bd4..729494c52 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindAccessory.cs @@ -45,32 +45,32 @@ namespace SqlSugar { while (re.Read()) { - if (PubConst.DicOO == type) + if (UtilConstants.DicOO == type) { var kv = new KeyValuePair(dataReader.GetValue(0), re.GetValue(1)); reval.Add((T)Convert.ChangeType(kv, typeof(KeyValuePair))); } - else if (PubConst.DicIS == type) + else if (UtilConstants.DicIS == type) { var kv = new KeyValuePair(dataReader.GetValue(0).ObjToInt(), re.GetValue(1).ObjToString()); reval.Add((T)Convert.ChangeType(kv, typeof(KeyValuePair))); } - else if (PubConst.Dicii == type) + else if (UtilConstants.Dicii == type) { var kv = new KeyValuePair(dataReader.GetValue(0).ObjToInt(), re.GetValue(1).ObjToInt()); reval.Add((T)Convert.ChangeType(kv, typeof(KeyValuePair))); } - else if (PubConst.DicSi == type) + else if (UtilConstants.DicSi == type) { var kv = new KeyValuePair(dataReader.GetValue(0).ObjToString(), re.GetValue(1).ObjToInt()); reval.Add((T)Convert.ChangeType(kv, typeof(KeyValuePair))); } - else if (PubConst.DicSo == type) + else if (UtilConstants.DicSo == type) { var kv = new KeyValuePair(dataReader.GetValue(0).ObjToString(), re.GetValue(1)); reval.Add((T)Convert.ChangeType(kv, typeof(KeyValuePair))); } - else if (PubConst.DicSS == type) + else if (UtilConstants.DicSS == type) { var kv = new KeyValuePair(dataReader.GetValue(0).ObjToString(), dataReader.GetValue(1).ObjToString()); reval.Add((T)Convert.ChangeType(kv, typeof(KeyValuePair))); @@ -98,21 +98,21 @@ namespace SqlSugar { array[i] = Convert.ChangeType(re.GetValue(i), childType); } - if (childType == PubConst.StringType) + if (childType == UtilConstants.StringType) reval.Add((T)Convert.ChangeType(array.Select(it => it.ObjToString()).ToArray(), type)); - else if (childType == PubConst.ObjType) + else if (childType == UtilConstants.ObjType) reval.Add((T)Convert.ChangeType(array.Select(it => it == DBNull.Value ? null : (object)it).ToArray(), type)); - else if (childType == PubConst.BoolType) + else if (childType == UtilConstants.BoolType) reval.Add((T)Convert.ChangeType(array.Select(it => it.ObjToBool()).ToArray(), type)); - else if (childType == PubConst.ByteType) + else if (childType == UtilConstants.ByteType) reval.Add((T)Convert.ChangeType(array.Select(it => it == DBNull.Value ? 0 : (byte)it).ToArray(), type)); - else if (childType == PubConst.DecType) + else if (childType == UtilConstants.DecType) reval.Add((T)Convert.ChangeType(array.Select(it => it.ObjToDecimal()).ToArray(), type)); - else if (childType == PubConst.GuidType) + else if (childType == UtilConstants.GuidType) reval.Add((T)Convert.ChangeType(array.Select(it => it == DBNull.Value ? Guid.Empty : (Guid)it).ToArray(), type)); - else if (childType == PubConst.DateType) + else if (childType == UtilConstants.DateType) reval.Add((T)Convert.ChangeType(array.Select(it => it == DBNull.Value ? DateTime.MinValue : (DateTime)it).ToArray(), type)); - else if (childType == PubConst.IntType) + else if (childType == UtilConstants.IntType) reval.Add((T)Convert.ChangeType(array.Select(it => it.ObjToInt()).ToArray(), type)); else Check.Exception(true, ErrorMessage.NotSupportedArray); diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs index fa95ddc5c..1c954d95a 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/DbBindProvider.cs @@ -17,7 +17,7 @@ namespace SqlSugar #region Public methods public virtual string GetDbTypeName(string csharpTypeName) { - if (csharpTypeName == PubConst.ByteArrayType.Name) + if (csharpTypeName == UtilConstants.ByteArrayType.Name) { return "varbinary"; } @@ -173,7 +173,7 @@ namespace SqlSugar { return GetKeyValueList(type, dataReader); } - else if (type.IsValueType() || type == PubConst.StringType) + else if (type.IsValueType() || type == UtilConstants.StringType) { return GetValueTypeList(type, dataReader); } diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs index d390000cd..5ad02c191 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs @@ -123,7 +123,7 @@ namespace SqlSugar } if (propertyInfo != null && propertyInfo.GetSetMethod() != null) { - if (propertyInfo.PropertyType.IsClass() && propertyInfo.PropertyType != PubConst.ByteArrayType) + if (propertyInfo.PropertyType.IsClass() && propertyInfo.PropertyType != UtilConstants.ByteArrayType) { BindClass(generator, result, propertyInfo); } @@ -186,15 +186,15 @@ namespace SqlSugar { method = isNullableType ? getConvertEnum_Null.MakeGenericMethod(bindPropertyType) : getEnum.MakeGenericMethod(bindPropertyType); } - else if (bindPropertyType == PubConst.IntType) + else if (bindPropertyType == UtilConstants.IntType) { method = isNullableType ? getConvertInt32 : getInt32; } - else if (bindPropertyType == PubConst.StringType) + else if (bindPropertyType == UtilConstants.StringType) { method = getString; } - else if (bindPropertyType == PubConst.ByteArrayType) + else if (bindPropertyType == UtilConstants.ByteArrayType) { method = getValueMethod; generator.Emit(OpCodes.Call, method); @@ -280,7 +280,7 @@ namespace SqlSugar method = getValueMethod; break; } - if (method == null && bindPropertyType == PubConst.StringType) + if (method == null && bindPropertyType == UtilConstants.StringType) { method = getConvertString; } diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs index f0a7b77ec..4394daeeb 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs @@ -205,27 +205,27 @@ namespace SqlSugar private static T SqliteTypeConvert(IDataReader dr, int i, Type type) where T : struct { - if (type.IsIn(PubConst.IntType)) + if (type.IsIn(UtilConstants.IntType)) { return (T)((object)(dr.GetInt32(i))); } - else if (type == PubConst.DateType) + else if (type == UtilConstants.DateType) { return (T)Convert.ChangeType(Convert.ToDateTime(dr.GetString(i)), type); } - else if (type == PubConst.DecType) + else if (type == UtilConstants.DecType) { return (T)Convert.ChangeType(dr.GetDecimal(i), type); } - else if (type == PubConst.DobType) + else if (type == UtilConstants.DobType) { return (T)Convert.ChangeType(dr.GetDouble(i), type); } - else if (type == PubConst.BoolType) + else if (type == UtilConstants.BoolType) { return (T)Convert.ChangeType(dr.GetBoolean(i), type); } - else if (type == PubConst.GuidType) + else if (type == UtilConstants.GuidType) { string guidString = dr.GetString(i); string changeValue = guidString.IsNullOrEmpty() ? Guid.Empty.ToString() : guidString; diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs index bb2eec79d..52f9ffa4b 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs @@ -154,7 +154,7 @@ namespace SqlSugar } classText = classText.Replace(DbFirstTemplate.KeyClassName, className); classText = classText.Replace(DbFirstTemplate.KeyNamespace, this.Namespace); - classText = classText.Replace(DbFirstTemplate.KeyUsing, IsAttribute ? (this.UsingTemplate + "using " + PubConst.AssemblyName + ";\r\n") : this.UsingTemplate); + classText = classText.Replace(DbFirstTemplate.KeyUsing, IsAttribute ? (this.UsingTemplate + "using " + UtilConstants.AssemblyName + ";\r\n") : this.UsingTemplate); classText = classText.Replace(DbFirstTemplate.KeyClassDescription, this.ClassDescriptionTemplate.Replace(DbFirstTemplate.KeyClassDescription, tableInfo.Description + "\r\n")); classText = classText.Replace(DbFirstTemplate.KeySugarTable, IsAttribute ? string.Format(DbFirstTemplate.ValueSugarTable, tableInfo.Name) : null); if (columns.IsValuable()) diff --git a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs index 37ee1ed49..b41a0f2da 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs @@ -84,14 +84,14 @@ namespace SqlSugar var isFirst = deleteObjs.IndexOf(deleteObj) == 0; if (isFirst) { - orString.Append(DeleteBuilder.WhereInOrTemplate + PubConst.Space); + orString.Append(DeleteBuilder.WhereInOrTemplate + UtilConstants.Space); } int i = 0; StringBuilder andString = new StringBuilder(); foreach (var primaryField in primaryFields) { if (i == 0) - andString.Append(DeleteBuilder.WhereInAndTemplate + PubConst.Space); + andString.Append(DeleteBuilder.WhereInAndTemplate + UtilConstants.Space); var entityPropertyName = this.Context.EntityProvider.GetPropertyName(primaryField); var columnInfo = EntityInfo.Columns.Single(it => it.PropertyName == entityPropertyName); var entityValue = columnInfo.PropertyInfo.GetValue(deleteObj, null); diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index b0589ebda..81fdd3737 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -131,7 +131,7 @@ namespace SqlSugar public virtual ISugarQueryable Where(string whereString, object whereObj = null) { var whereValue = QueryBuilder.WhereInfos; - whereValue.Add(SqlBuilder.AppendWhereOrAnd(whereValue.Count == 0, whereString + PubConst.Space)); + whereValue.Add(SqlBuilder.AppendWhereOrAnd(whereValue.Count == 0, whereString + UtilConstants.Space)); if (whereObj != null) QueryBuilder.Parameters.AddRange(Context.Ado.GetParameters(whereObj)); return this; @@ -577,7 +577,7 @@ namespace SqlSugar { var isSingle = QueryBuilder.IsSingle(); var lamResult = QueryBuilder.GetExpressionValue(expression, isSingle ? ResolveExpressType.FieldSingle : ResolveExpressType.FieldMultiple); - OrderBy(lamResult.GetResultString() + PubConst.Space + type.ToString().ToUpper()); + OrderBy(lamResult.GetResultString() + UtilConstants.Space + type.ToString().ToUpper()); return this; } protected ISugarQueryable _GroupBy(Expression expression) @@ -729,7 +729,7 @@ namespace SqlSugar { if (result.IsValuable()) { - if (entityType.GetTypeInfo().BaseType.IsValuable() && entityType.GetTypeInfo().BaseType == PubConst.ModelType) + if (entityType.GetTypeInfo().BaseType.IsValuable() && entityType.GetTypeInfo().BaseType == UtilConstants.ModelType) { foreach (var item in result) { diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs index 88b115dd8..89b1d3a7d 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs @@ -83,10 +83,10 @@ namespace SqlSugar get { var result = Builder.GetTranslationTableName(EntityInfo.EntityName); - result += PubConst.Space; + result += UtilConstants.Space; if (this.TableWithString.IsValuable()) { - result += TableWithString + PubConst.Space; + result += TableWithString + UtilConstants.Space; } return result; } @@ -102,7 +102,7 @@ namespace SqlSugar { var isFirst = i == 0; whereString += isFirst ? "WHERE " : "AND "; - whereString += (item + PubConst.Space); + whereString += (item + UtilConstants.Space); ++i; } return whereString; diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs index 770d969c0..d57d96aae 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs @@ -86,10 +86,10 @@ namespace SqlSugar get { var result = Builder.GetTranslationTableName(EntityInfo.EntityName); - result += PubConst.Space; + result += UtilConstants.Space; if (this.TableWithString.IsValuable()) { - result += TableWithString + PubConst.Space; + result += TableWithString + UtilConstants.Space; } return result; } @@ -156,7 +156,7 @@ namespace SqlSugar else { var type = value.GetType(); - if (type == PubConst.DateType) + if (type == UtilConstants.DateType) { var date = value.ObjToDate(); if (date < Convert.ToDateTime("1900-1-1")) @@ -169,11 +169,11 @@ namespace SqlSugar { return Convert.ToInt64(value); } - else if (type == PubConst.BoolType) + else if (type == UtilConstants.BoolType) { return value.ObjToBool() ? "1" : "0"; } - else if (type == PubConst.StringType || type == PubConst.ObjType) + else if (type == UtilConstants.StringType || type == UtilConstants.ObjType) { return "N'" + value.ToString().ToSqlFilter() + "'"; } diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs index 70a905e76..1bd59632e 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs @@ -314,9 +314,9 @@ namespace SqlSugar { return string.Format( this.JoinTemplate, - joinInfo.JoinType.ToString() + PubConst.Space, - Builder.GetTranslationTableName(joinInfo.TableName) + PubConst.Space, - joinInfo.ShortName + PubConst.Space + joinInfo.TableWithString, + joinInfo.JoinType.ToString() + UtilConstants.Space, + Builder.GetTranslationTableName(joinInfo.TableName) + UtilConstants.Space, + joinInfo.ShortName + UtilConstants.Space + joinInfo.TableWithString, joinInfo.JoinWhere); } public virtual void Clear() @@ -392,7 +392,7 @@ namespace SqlSugar if (this.WhereInfos == null) return null; else { - return string.Join(PubConst.Space, this.WhereInfos); + return string.Join(UtilConstants.Space, this.WhereInfos); } } } @@ -403,7 +403,7 @@ namespace SqlSugar if (this.JoinQueryInfos.IsNullOrEmpty()) return null; else { - return string.Join(PubConst.Space, this.JoinQueryInfos.Select(it => this.ToJoinString(it))); + return string.Join(UtilConstants.Space, this.JoinQueryInfos.Select(it => this.ToJoinString(it))); } } } @@ -412,18 +412,18 @@ namespace SqlSugar get { var result = Builder.GetTranslationTableName(EntityName); - result += PubConst.Space; + result += UtilConstants.Space; if (this.TableWithString.IsValuable()) { - result += TableWithString + PubConst.Space; + result += TableWithString + UtilConstants.Space; } if (this.TableShortName.IsValuable()) { - result += (TableShortName + PubConst.Space); + result += (TableShortName + UtilConstants.Space); } if (!this.IsSingle()) { - result += GetJoinValueString + PubConst.Space; + result += GetJoinValueString + UtilConstants.Space; } if (this.EasyJoinInfos.IsValuable()) { @@ -459,7 +459,7 @@ namespace SqlSugar if (this.GroupByValue == null) return null; if (this.GroupByValue.Last() != ' ' ) { - return this.GroupByValue + PubConst.Space; + return this.GroupByValue + UtilConstants.Space; } return this.GroupByValue; } diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs index 05dffc893..d26ad951c 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs @@ -92,10 +92,10 @@ namespace SqlSugar get { var result = Builder.GetTranslationTableName(TableName); - result += PubConst.Space; + result += UtilConstants.Space; if (this.TableWithString.IsValuable()) { - result += TableWithString + PubConst.Space; + result += TableWithString + UtilConstants.Space; } return result; } @@ -250,7 +250,7 @@ namespace SqlSugar else { var type = value.GetType(); - if (type == PubConst.DateType) + if (type == UtilConstants.DateType) { var date = value.ObjToDate(); if (date < Convert.ToDateTime("1900-1-1")) @@ -263,11 +263,11 @@ namespace SqlSugar { return Convert.ToInt64(value); } - else if (type == PubConst.BoolType) + else if (type == UtilConstants.BoolType) { return value.ObjToBool() ? "1" : "0"; } - else if (type == PubConst.StringType || type == PubConst.ObjType) + else if (type == UtilConstants.StringType || type == UtilConstants.ObjType) { return "N'" + value.ToString().ToSqlFilter() + "'"; } diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs index bde2bc467..b39da6e2a 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs @@ -147,7 +147,7 @@ namespace SqlSugar FieldInfo field = (FieldInfo)memberExpr.Member; Check.Exception(field.IsPrivate, string.Format(" Field \"{0}\" can't be private ", field.Name)); reval = field.GetValue(memberExpr.Member); - if (reval != null && reval.GetType().IsClass() && reval.GetType() != PubConst.StringType) + if (reval != null && reval.GetType().IsClass() && reval.GetType() != UtilConstants.StringType) { var fieldName = memberExpr.Member.Name; var proInfo = reval.GetType().GetProperty(fieldName); @@ -190,7 +190,7 @@ namespace SqlSugar object reval = null; PropertyInfo pro = (PropertyInfo)memberExpr.Member; reval = pro.GetValue(memberExpr.Member, null); - if (reval != null && reval.GetType().IsClass() && reval.GetType() != PubConst.StringType) + if (reval != null && reval.GetType().IsClass() && reval.GetType() != UtilConstants.StringType) { var fieldName = memberExpr.Member.Name; var proInfo = reval.GetType().GetProperty(fieldName); @@ -214,7 +214,7 @@ namespace SqlSugar public static object DynamicInvoke(Expression expression,MemberExpression memberExpression=null) { object value = Expression.Lambda(expression).Compile().DynamicInvoke(); - if (value != null && value.GetType().IsClass() && value.GetType() != PubConst.StringType&& memberExpression!=null) + if (value != null && value.GetType().IsClass() && value.GetType() != UtilConstants.StringType&& memberExpression!=null) { value = Expression.Lambda(memberExpression).Compile().DynamicInvoke(); } @@ -233,7 +233,7 @@ namespace SqlSugar public static bool IsEntity(Type type) { - return type.IsClass() && type != PubConst.StringType; + return type.IsClass() && type != UtilConstants.StringType; } public static bool IsValueType(Type type) diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs index 5705240c0..816ba1072 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/SugarParameter.cs @@ -27,47 +27,47 @@ namespace SqlSugar private void SettingDataType(Type type) { - if (type == PubConst.ByteArrayType) + if (type == UtilConstants.ByteArrayType) { this.DbType = System.Data.DbType.Binary; } - else if (type == PubConst.GuidType) + else if (type == UtilConstants.GuidType) { this.DbType = System.Data.DbType.Guid; } - else if (type == PubConst.IntType) + else if (type == UtilConstants.IntType) { this.DbType = System.Data.DbType.Int32; } - else if (type == PubConst.ShortType) + else if (type == UtilConstants.ShortType) { this.DbType = System.Data.DbType.Int16; } - else if (type == PubConst.LongType) + else if (type == UtilConstants.LongType) { this.DbType = System.Data.DbType.Int64; } - else if (type == PubConst.DateType) + else if (type == UtilConstants.DateType) { this.DbType = System.Data.DbType.DateTime; } - else if (type == PubConst.DobType) + else if (type == UtilConstants.DobType) { this.DbType = System.Data.DbType.Double; } - else if (type == PubConst.DecType) + else if (type == UtilConstants.DecType) { this.DbType = System.Data.DbType.Decimal; } - else if (type == PubConst.ByteType) + else if (type == UtilConstants.ByteType) { this.DbType = System.Data.DbType.Byte; } - else if (type == PubConst.FloatType) + else if (type == UtilConstants.FloatType) { this.DbType = System.Data.DbType.Single; } - else if (type == PubConst.BoolType) + else if (type == UtilConstants.BoolType) { this.DbType = System.Data.DbType.Boolean; } @@ -109,7 +109,7 @@ namespace SqlSugar { if (_Size == 0 && Value != null) { - var isByteArray = Value.GetType() == PubConst.ByteArrayType; + var isByteArray = Value.GetType() == UtilConstants.ByteArrayType; if (isByteArray) _Size = -1; else diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs index bdc5f948c..3d1cdf688 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs @@ -33,7 +33,7 @@ namespace SqlSugar { var parentIsBinary = parameter.BaseParameter.CurrentExpression is BinaryExpression; var parentIsRoot = parameter.BaseParameter.CurrentExpression is LambdaExpression; - var isBool = value != null && value.GetType() == PubConst.BoolType; + var isBool = value != null && value.GetType() == UtilConstants.BoolType; if (parentIsRoot && isBool) { this.Context.Result.Append(value.ObjToBool() ? this.Context.DbMehtods.True() : this.Context.DbMehtods.False()); diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs index ba190db48..40e6ee4eb 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs @@ -15,10 +15,10 @@ namespace SqlSugar var isSetTempData = baseParameter.CommonTempData.IsValuable() && baseParameter.CommonTempData.Equals(CommonTempDataType.Result); var expression = base.Expression as MemberExpression; var isValue = expression.Member.Name == "Value" && expression.Member.DeclaringType.Name == "Nullable`1"; - var isBool = expression.Type == PubConst.BoolType; + var isBool = expression.Type == UtilConstants.BoolType; var isValueBool = isValue && isBool && parameter.BaseExpression == null; - var isLength = expression.Member.Name == "Length" && (expression.Expression as MemberExpression).Type == PubConst.StringType; - var isDateValue = expression.Member.Name.IsIn(Enum.GetNames(typeof(DateType))) && (expression.Expression as MemberExpression).Type == PubConst.DateType; + var isLength = expression.Member.Name == "Length" && (expression.Expression as MemberExpression).Type == UtilConstants.StringType; + var isDateValue = expression.Member.Name.IsIn(Enum.GetNames(typeof(DateType))) && (expression.Expression as MemberExpression).Type == UtilConstants.DateType; var isLogicOperator = ExpressionTool.IsLogicOperator(baseParameter.OperatorValue) || baseParameter.OperatorValue.IsNullOrEmpty(); var isHasValue = isLogicOperator && expression.Member.Name == "HasValue" && expression.Expression != null && expression.NodeType == ExpressionType.MemberAccess; if (isLength) @@ -144,7 +144,7 @@ namespace SqlSugar { fieldName = GetName(parameter, expression, isLeft, isSingle); } - if (expression.Type == PubConst.BoolType && baseParameter.OperatorValue.IsNullOrEmpty()) + if (expression.Type == UtilConstants.BoolType && baseParameter.OperatorValue.IsNullOrEmpty()) { fieldName = "( " + fieldName + "=1 )"; } diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index 862023227..f6db014f2 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -161,10 +161,10 @@ namespace SqlSugar var isBinaryExpression = item is BinaryExpression || item is MethodCallExpression; var isConst = item is ConstantExpression; var isIIF= name == "IIF"; - var isIFFBoolMember = isIIF && (item is MemberExpression) && (item as MemberExpression).Type == PubConst.BoolType; - var isIFFUnary = isIIF && (item is UnaryExpression) && (item as UnaryExpression).Operand.Type == PubConst.BoolType; - var isIFFBoolBinary = isIIF && (item is BinaryExpression) && (item as BinaryExpression).Type == PubConst.BoolType; - var isIFFBoolMethod = isIIF && (item is MethodCallExpression) && (item as MethodCallExpression).Type == PubConst.BoolType; + var isIFFBoolMember = isIIF && (item is MemberExpression) && (item as MemberExpression).Type == UtilConstants.BoolType; + var isIFFUnary = isIIF && (item is UnaryExpression) && (item as UnaryExpression).Operand.Type == UtilConstants.BoolType; + var isIFFBoolBinary = isIIF && (item is BinaryExpression) && (item as BinaryExpression).Type == UtilConstants.BoolType; + var isIFFBoolMethod = isIIF && (item is MethodCallExpression) && (item as MethodCallExpression).Type == UtilConstants.BoolType; var isFirst = item == args.First(); if (isFirst && isIIF && isConst) { diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/NewExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/NewExpressionResolve.cs index 88b4d3c06..9c2e224b6 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/NewExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/NewExpressionResolve.cs @@ -22,11 +22,11 @@ namespace SqlSugar Check.ThrowNotSupportedException(expression.ToString()); break; case ResolveExpressType.SelectSingle: - Check.Exception(expression.Type == PubConst.DateType, "ThrowNotSupportedException {0} ",expression.ToString()); + Check.Exception(expression.Type == UtilConstants.DateType, "ThrowNotSupportedException {0} ",expression.ToString()); Select(expression, parameter, true); break; case ResolveExpressType.SelectMultiple: - Check.Exception(expression.Type == PubConst.DateType, "ThrowNotSupportedException {0} ", expression.ToString()); + Check.Exception(expression.Type == UtilConstants.DateType, "ThrowNotSupportedException {0} ", expression.ToString()); Select(expression, parameter, false); break; case ResolveExpressType.FieldSingle: diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/UnaryExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/UnaryExpressionResolve.cs index c946c7fe9..8a6225e2b 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/UnaryExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/UnaryExpressionResolve.cs @@ -92,7 +92,7 @@ namespace SqlSugar parameter.CommonTempData = null; } } - else if (memberExpression.Type == PubConst.BoolType && isLogicOperator) + else if (memberExpression.Type == UtilConstants.BoolType && isLogicOperator) { Append(parameter, nodeType); } diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs index fbd98a3d9..525f912a9 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs @@ -8,7 +8,7 @@ namespace SqlSugar { public class InstanceFactory { - static Assembly assembly = Assembly.Load(PubConst.AssemblyName); + static Assembly assembly = Assembly.Load(UtilConstants.AssemblyName); static Dictionary typeCache = new Dictionary(); #region Queryable @@ -202,7 +202,7 @@ namespace SqlSugar private static string GetClassName(string type, string name) { - return PubConst.AssemblyName + "." + type + name; + return UtilConstants.AssemblyName + "." + type + name; } #region CreateInstance diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/RewritableMethods.cs b/Src/Asp.Net/SqlSugar/Infrastructure/RewritableMethods.cs index b0d4b3907..f653518fb 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/RewritableMethods.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/RewritableMethods.cs @@ -108,19 +108,19 @@ namespace SqlSugar var addValue = readerValues[name]; if (addValue == DBNull.Value) { - if (item.PropertyType.IsIn(PubConst.IntType, PubConst.DecType, PubConst.DobType, PubConst.ByteType)) + if (item.PropertyType.IsIn(UtilConstants.IntType, UtilConstants.DecType, UtilConstants.DobType, UtilConstants.ByteType)) { addValue = 0; } - else if (item.PropertyType == PubConst.GuidType) + else if (item.PropertyType == UtilConstants.GuidType) { addValue = Guid.Empty; } - else if (item.PropertyType == PubConst.DateType) + else if (item.PropertyType == UtilConstants.DateType) { addValue = DateTime.MinValue; } - else if (item.PropertyType == PubConst.StringType) + else if (item.PropertyType == UtilConstants.StringType) { addValue = null; } @@ -131,7 +131,7 @@ namespace SqlSugar } else { - if (item.PropertyType == PubConst.IntType) + if (item.PropertyType == UtilConstants.IntType) { addValue = Convert.ToInt32(addValue); } diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs index d684c4b75..da5e969b1 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs @@ -277,7 +277,7 @@ namespace SqlSugar var index = 1; foreach (var item in entityTypeArray) { - result.Add(PubConst.Space +lambdaParameters[index].Name, item.Name); + result.Add(UtilConstants.Space +lambdaParameters[index].Name, item.Name); ++index; } return result; diff --git a/Src/Asp.Net/SqlSugar/Realization/MySql/DbBind/MySqlDbBind.cs b/Src/Asp.Net/SqlSugar/Realization/MySql/DbBind/MySqlDbBind.cs index e246fb0e4..d6cfecfe5 100644 --- a/Src/Asp.Net/SqlSugar/Realization/MySql/DbBind/MySqlDbBind.cs +++ b/Src/Asp.Net/SqlSugar/Realization/MySql/DbBind/MySqlDbBind.cs @@ -8,7 +8,7 @@ namespace SqlSugar { public override string GetDbTypeName(string csharpTypeName) { - if (csharpTypeName == PubConst.ByteArrayType.Name) + if (csharpTypeName == UtilConstants.ByteArrayType.Name) { return "blob"; } diff --git a/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbBind/SqliteDbBind.cs b/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbBind/SqliteDbBind.cs index 270565aad..97d7a46e6 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbBind/SqliteDbBind.cs +++ b/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbBind/SqliteDbBind.cs @@ -8,7 +8,7 @@ namespace SqlSugar { public override string GetDbTypeName(string csharpTypeName) { - if (csharpTypeName == PubConst.ByteArrayType.Name) + if (csharpTypeName == UtilConstants.ByteArrayType.Name) { return "blob"; } diff --git a/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteInsertBuilder.cs b/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteInsertBuilder.cs index 0f36db39f..3db3f7366 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteInsertBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteInsertBuilder.cs @@ -43,7 +43,7 @@ namespace SqlSugar else { var type = value.GetType(); - if (type == PubConst.DateType) + if (type == UtilConstants.DateType) { var date = value.ObjToDate(); if (date < Convert.ToDateTime("1900-1-1")) @@ -56,11 +56,11 @@ namespace SqlSugar { return Convert.ToInt64(value); } - else if (type == PubConst.BoolType) + else if (type == UtilConstants.BoolType) { return value.ObjToBool() ? "1" : "0"; } - else if (type == PubConst.StringType || type == PubConst.ObjType) + else if (type == UtilConstants.StringType || type == UtilConstants.ObjType) { return "'" + value.ToString().ToSqlFilter() + "'"; } diff --git a/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteUpdateBuilder.cs b/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteUpdateBuilder.cs index c95674dd0..5b2bd575b 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteUpdateBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqlBuilder/SqliteUpdateBuilder.cs @@ -20,7 +20,7 @@ namespace SqlSugar else { var type = value.GetType(); - if (type == PubConst.DateType) + if (type == UtilConstants.DateType) { var date = value.ObjToDate(); if (date < Convert.ToDateTime("1900-1-1")) @@ -33,11 +33,11 @@ namespace SqlSugar { return Convert.ToInt64(value); } - else if (type == PubConst.BoolType) + else if (type == UtilConstants.BoolType) { return value.ObjToBool() ? "1" : "0"; } - else if (type == PubConst.StringType || type == PubConst.ObjType) + else if (type == UtilConstants.StringType || type == UtilConstants.ObjType) { return "'" + value.ToString().ToSqlFilter() + "'"; } diff --git a/Src/Asp.Net/SqlSugar/SqlSugar.csproj b/Src/Asp.Net/SqlSugar/SqlSugar.csproj index 204d7a8e9..dbb537448 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugar.csproj +++ b/Src/Asp.Net/SqlSugar/SqlSugar.csproj @@ -139,8 +139,8 @@ - - + + diff --git a/Src/Asp.Net/SqlSugar/Utilities/PubConst.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs similarity index 97% rename from Src/Asp.Net/SqlSugar/Utilities/PubConst.cs rename to Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs index 8fb9d845b..b4e0397c8 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/PubConst.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; namespace SqlSugar { - internal static class PubConst + internal static class UtilConstants { internal const string AssemblyName = "SqlSugar"; internal const string Space = " "; diff --git a/Src/Asp.Net/SqlSugar/Utilities/PubConvert.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilsConvert.cs similarity index 98% rename from Src/Asp.Net/SqlSugar/Utilities/PubConvert.cs rename to Src/Asp.Net/SqlSugar/Utilities/UtilsConvert.cs index 47486cf24..27d913890 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/PubConvert.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilsConvert.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; namespace SqlSugar { - public static class PubConvert + public static class UtilsConvert { public static int ObjToInt(this object thisValue) {