From 345f0b0790ea386f3a1d7c86a2c53371f4ce36b1 Mon Sep 17 00:00:00 2001 From: SampsonYe Date: Fri, 1 Jul 2022 14:58:08 +0800 Subject: [PATCH] fix InitTables error when entity has complex props --- .../EntityMaintenance/EntityMaintenance.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs b/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs index d216e311d..272a8f638 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs @@ -258,17 +258,7 @@ namespace SqlSugar } 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) { column.DbColumnName = sugarColumn.ColumnName.IsNullOrEmpty() ? property.Name : sugarColumn.ColumnName; @@ -294,6 +284,18 @@ namespace SqlSugar column.IsArray = sugarColumn.IsArray; column.IsTreeKey = sugarColumn.IsTreeKey; 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 {