Compatible with .NET CORE

This commit is contained in:
sunkaixuan
2017-07-01 13:10:36 +08:00
parent 91a4e02a05
commit 9c2740b927
5 changed files with 7 additions and 7 deletions

View File

@@ -48,7 +48,7 @@ namespace SqlSugar
foreach (PropertyInfo properyty in properties) foreach (PropertyInfo properyty in properties)
{ {
var value = properyty.GetValue(parameters, null); var value = properyty.GetValue(parameters, null);
if (properyty.PropertyType.IsEnum) if (properyty.PropertyType.IsEnum())
{ {
value = Convert.ToInt64(value); value = Convert.ToInt64(value);
} }

View File

@@ -112,7 +112,7 @@ namespace SqlSugar
.Where(ec => !dbColumns.Any(dc => dc.DbColumnName.Equals(ec.OldDbColumnName, StringComparison.CurrentCultureIgnoreCase))) .Where(ec => !dbColumns.Any(dc => dc.DbColumnName.Equals(ec.OldDbColumnName, StringComparison.CurrentCultureIgnoreCase)))
.Where(ec => .Where(ec =>
dbColumns.Any(dc => dc.DbColumnName.Equals(ec.DbColumnName) 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(PubConst.StringType)) ||
ec.IsNullable != dc.IsNullable || ec.IsNullable != dc.IsNullable ||
IsSamgeType(ec, dc)))).ToList(); IsSamgeType(ec, dc)))).ToList();
var renameColumns = entityColumns var renameColumns = entityColumns
@@ -222,7 +222,7 @@ namespace SqlSugar
ColumnDescription = item.ColumnDescription, ColumnDescription = item.ColumnDescription,
Length = item.Length Length = item.Length
}; };
if (propertyType.IsEnum) 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?PubConst.LongType.Name:PubConst.IntType.Name);
} }
@@ -237,7 +237,7 @@ namespace SqlSugar
{ {
var propertyType = PubMethod.GetUnderType(ec.PropertyInfo); var propertyType = PubMethod.GetUnderType(ec.PropertyInfo);
var properyTypeName = string.Empty; var properyTypeName = string.Empty;
if (propertyType.IsEnum) 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 ? PubConst.LongType.Name : PubConst.IntType.Name);
} }

View File

@@ -164,7 +164,7 @@ namespace SqlSugar
validPropertyName = validPropertyName == "byte[]" ? "byteArray" : validPropertyName; validPropertyName = validPropertyName == "byte[]" ? "byteArray" : validPropertyName;
CSharpDataType validPropertyType = (CSharpDataType)Enum.Parse(typeof(CSharpDataType), validPropertyName); CSharpDataType validPropertyType = (CSharpDataType)Enum.Parse(typeof(CSharpDataType), validPropertyName);
string bindProperyTypeName = bindPropertyType.Name.ToLower(); string bindProperyTypeName = bindPropertyType.Name.ToLower();
bool isEnum = bindPropertyType.IsEnum; bool isEnum = bindPropertyType.IsEnum();
if (isEnum) { validPropertyType = CSharpDataType.@enum; } if (isEnum) { validPropertyType = CSharpDataType.@enum; }
switch (validPropertyType) switch (validPropertyType)
{ {

View File

@@ -166,7 +166,7 @@ namespace SqlSugar
PropertyType = PubMethod.GetUnderType(column.PropertyInfo), PropertyType = PubMethod.GetUnderType(column.PropertyInfo),
TableId = i TableId = i
}; };
if (columnInfo.PropertyType.IsEnum) if (columnInfo.PropertyType.IsEnum())
{ {
columnInfo.Value = Convert.ToInt64(columnInfo.Value); columnInfo.Value = Convert.ToInt64(columnInfo.Value);
} }

View File

@@ -166,7 +166,7 @@ namespace SqlSugar
PropertyType=PubMethod.GetUnderType(column.PropertyInfo), PropertyType=PubMethod.GetUnderType(column.PropertyInfo),
TableId = i TableId = i
}; };
if (columnInfo.PropertyType.IsEnum) if (columnInfo.PropertyType.IsEnum())
{ {
columnInfo.Value = Convert.ToInt64(columnInfo.Value); columnInfo.Value = Convert.ToInt64(columnInfo.Value);
} }