From f40ed286ced34b3cddcf83341e448b04bfb1345e Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 30 Aug 2017 15:36:28 +0800 Subject: [PATCH] - --- .../Common/ExpressionConst.cs | 2 -- .../ExpressionsToSql/ExpressionContext.cs | 12 +++++----- .../SqlSugar/Utilities/UtilConstants.cs | 23 ++++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionConst.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionConst.cs index 1e570b37d..6420df23e 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionConst.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionConst.cs @@ -16,8 +16,6 @@ namespace SqlSugar public const string SqlFuncFullName = "SqlSugar.SqlFunc"; public const string MethodConst = "MethodConst"; public const string Const = "Const"; - public const string Dot = "."; - public const char DotChar = '.'; public readonly static Type MemberExpressionType = typeof(MemberExpression); public readonly static Type ConstantExpressionType = typeof(ConstantExpression); } diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs index 4e52474f4..12cdb20d8 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs @@ -128,16 +128,16 @@ namespace SqlSugar Check.ArgumentNullException(entityName, string.Format(ErrorMessage.ObjNotExist, "Table Name")); if (IsTranslationText(entityName)) return entityName; isMapping = isMapping && this.MappingTables.IsValuable(); - var isComplex = entityName.Contains(ExpressionConst.Dot); + var isComplex = entityName.Contains(UtilConstants.Dot); if (isMapping && isComplex) { - var columnInfo = entityName.Split(ExpressionConst.DotChar); + var columnInfo = entityName.Split(UtilConstants.DotChar); var mappingInfo = this.MappingTables.FirstOrDefault(it => it.EntityName.Equals(columnInfo.Last(), StringComparison.CurrentCultureIgnoreCase)); if (mappingInfo != null) { columnInfo[columnInfo.Length - 1] = mappingInfo.EntityName; } - return string.Join(ExpressionConst.Dot, columnInfo.Select(it => GetTranslationText(it))); + return string.Join(UtilConstants.Dot, columnInfo.Select(it => GetTranslationText(it))); } else if (isMapping) { @@ -146,7 +146,7 @@ namespace SqlSugar } else if (isComplex) { - return string.Join(ExpressionConst.Dot, entityName.Split(ExpressionConst.DotChar).Select(it => GetTranslationText(it))); + return string.Join(UtilConstants.Dot, entityName.Split(UtilConstants.DotChar).Select(it => GetTranslationText(it))); } else { @@ -161,9 +161,9 @@ namespace SqlSugar return columnName; } if (IsTranslationText(columnName)) return columnName; - if (columnName.Contains(ExpressionConst.Dot)) + if (columnName.Contains(UtilConstants.Dot)) { - return string.Join(ExpressionConst.Dot, columnName.Split(ExpressionConst.DotChar).Select(it => GetTranslationText(it))); + return string.Join(UtilConstants.Dot, columnName.Split(UtilConstants.DotChar).Select(it => GetTranslationText(it))); } else { diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs index 0f68bc6a2..ef571b99d 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilConstants.cs @@ -6,31 +6,32 @@ namespace SqlSugar { internal static class UtilConstants { - + public const string Dot = "."; + public const char DotChar = '.'; internal const string Space = " "; internal const string AssemblyName = "SqlSugar"; internal const string OrderReplace = "{662E689B-17A1-4D06-9D27-F29EAB8BC3D6}"; - internal static Type StringType = typeof(string); - internal static Type ShortType = typeof(short); internal static Type IntType = typeof(int); internal static Type LongType = typeof(long); - internal static Type DecType = typeof(decimal); internal static Type GuidType = typeof(Guid); - internal static Type DateType = typeof(DateTime); - internal static Type ByteType = typeof(Byte); - internal static Type ByteArrayType = typeof(byte[]); internal static Type BoolType = typeof(bool); + internal static Type ByteType = typeof(Byte); internal static Type ObjType = typeof(object); internal static Type DobType = typeof(double); - internal static Type FloatType=typeof(float); + internal static Type FloatType = typeof(float); + internal static Type ShortType = typeof(short); + internal static Type DecType = typeof(decimal); + internal static Type StringType = typeof(string); + internal static Type DateType = typeof(DateTime); + internal static Type ByteArrayType = typeof(byte[]); internal static Type ModelType= typeof(ModelContext); - internal static Type DicSS = typeof(KeyValuePair); - internal static Type DicSi = typeof(KeyValuePair); internal static Type Dicii = typeof(KeyValuePair); + internal static Type DicIS = typeof(KeyValuePair); + internal static Type DicSi = typeof(KeyValuePair); + internal static Type DicSS = typeof(KeyValuePair); internal static Type DicOO = typeof(KeyValuePair); internal static Type DicSo = typeof(KeyValuePair); - internal static Type DicIS = typeof(KeyValuePair); internal static Type DicArraySS = typeof(Dictionary); internal static Type DicArraySO = typeof(Dictionary); }