mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-29 01:47:06 +08:00
Enumerations support configuration
This commit is contained in:
parent
26c1a9ee49
commit
2792ebfbe6
@ -647,7 +647,14 @@ namespace SqlSugar
|
||||
}
|
||||
if (columnInfo.PropertyType.IsEnum()&& columnInfo.Value!=null)
|
||||
{
|
||||
columnInfo.Value = Convert.ToInt64(columnInfo.Value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
columnInfo.Value = columnInfo.Value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
columnInfo.Value = Convert.ToInt64(columnInfo.Value);
|
||||
}
|
||||
}
|
||||
if (column.IsJson&& columnInfo.Value!=null)
|
||||
{
|
||||
|
@ -196,7 +196,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
}
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
{
|
||||
|
@ -304,7 +304,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
}
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
{
|
||||
|
@ -572,7 +572,14 @@ namespace SqlSugar
|
||||
};
|
||||
if (columnInfo.PropertyType.IsEnum()&& columnInfo.Value!=null)
|
||||
{
|
||||
columnInfo.Value = Convert.ToInt64(columnInfo.Value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
columnInfo.Value = columnInfo.Value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
columnInfo.Value = Convert.ToInt64(columnInfo.Value);
|
||||
}
|
||||
}
|
||||
if (column.IsJson)
|
||||
{
|
||||
|
@ -13,5 +13,6 @@ namespace SqlSugar
|
||||
public bool DisableNvarchar { get; set; }
|
||||
public bool PgSqlIsAutoToLower = true;
|
||||
public int DefaultCacheDurationInSeconds { get; set; }
|
||||
public bool? TableEnumIsString { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
}
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
{
|
||||
|
@ -119,7 +119,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
}
|
||||
}
|
||||
else if (type == UtilConstants.BoolType)
|
||||
{
|
||||
|
@ -99,7 +99,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
}
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
|
@ -61,7 +61,14 @@ namespace SqlSugar
|
||||
}
|
||||
else if (type.IsEnum())
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
if (this.Context.CurrentConnectionConfig.MoreSettings?.TableEnumIsString == true)
|
||||
{
|
||||
return value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Convert.ToInt64(value);
|
||||
}
|
||||
}
|
||||
else if (type == UtilConstants.ByteArrayType)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user