Browse Source

Compatible with .NET CORE

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
9c2740b927
  1. 2
      Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs
  2. 6
      Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs
  3. 2
      Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs
  4. 2
      Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs
  5. 2
      Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

2
Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoAccessory.cs

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

6
Src/Asp.Net/SqlSugar/Abstract/CodeFirstProvider/CodeFirstProvider.cs

@ -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.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 ||
IsSamgeType(ec, dc)))).ToList();
var renameColumns = entityColumns
@ -222,7 +222,7 @@ namespace SqlSugar
ColumnDescription = item.ColumnDescription,
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);
}
@ -237,7 +237,7 @@ namespace SqlSugar
{
var propertyType = PubMethod.GetUnderType(ec.PropertyInfo);
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);
}

2
Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs

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

2
Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs

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

2
Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs

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

Loading…
Cancel
Save