Browse Source

fix InitTables error when entity has complex props

pull/20/head
SampsonYe 2 years ago
parent
commit
345f0b0790
  1. 24
      Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs

24
Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs

@ -258,17 +258,7 @@ namespace SqlSugar
} }
else else
{ {
if (sugarColumn.IsJson && String.IsNullOrEmpty(sugarColumn.ColumnDataType))
{
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL)
{
column.DataType = "json";
}
else
{
column.DataType = "varchar(4000)";
}
}
if (sugarColumn.IsIgnore == false) if (sugarColumn.IsIgnore == false)
{ {
column.DbColumnName = sugarColumn.ColumnName.IsNullOrEmpty() ? property.Name : sugarColumn.ColumnName; column.DbColumnName = sugarColumn.ColumnName.IsNullOrEmpty() ? property.Name : sugarColumn.ColumnName;
@ -294,6 +284,18 @@ namespace SqlSugar
column.IsArray = sugarColumn.IsArray; column.IsArray = sugarColumn.IsArray;
column.IsTreeKey = sugarColumn.IsTreeKey; column.IsTreeKey = sugarColumn.IsTreeKey;
column.SqlParameterDbType = sugarColumn.SqlParameterDbType; column.SqlParameterDbType = sugarColumn.SqlParameterDbType;
if (sugarColumn.IsJson && String.IsNullOrEmpty(sugarColumn.ColumnDataType))
{
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL)
{
column.DataType = "json";
}
else
{
column.DataType = "varchar(4000)";
}
}
} }
else else
{ {

Loading…
Cancel
Save