From fcf02e0f1fdebf48d381c679faeab148048179a8 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 20 Dec 2017 10:24:56 +0800 Subject: [PATCH] - --- .../Infrastructure/SqlSugarAccessory.cs | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs index 9afac5e6f..1e4e46733 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/SqlSugarAccessory.cs @@ -137,8 +137,50 @@ namespace SqlSugar var reval = this.Context.EntityMaintenance.GetEntityInfo(type); return reval; }); - InitMppingInfo(entityInfo); + var copyObj = CopyEntityInfo(entityInfo); + InitMppingInfo(copyObj); } + + private EntityInfo CopyEntityInfo(EntityInfo entityInfo) + { + EntityInfo result = new EntityInfo() + { + DbTableName = entityInfo.DbTableName, + EntityName = entityInfo.EntityName, + Type = entityInfo.Type + }; + List columns = new List(); + if (entityInfo.Columns.HasValue()) + { + foreach (var item in entityInfo.Columns) + { + EntityColumnInfo column = new EntityColumnInfo() + { + ColumnDescription = item.ColumnDescription, + DataType = item.DataType, + DbColumnName = item.DbColumnName, + DbTableName = item.DbTableName, + DecimalDigits = item.DecimalDigits, + DefaultValue = item.DefaultValue, + EntityName = item.EntityName, + IsIdentity = item.IsIdentity, + IsIgnore = item.IsIgnore, + IsNullable = item.IsNullable, + IsOnlyIgnoreInsert = item.IsOnlyIgnoreInsert, + IsPrimarykey = item.IsPrimarykey, + Length = item.Length, + OldDbColumnName = item.OldDbColumnName, + OracleSequenceName = item.OracleSequenceName, + PropertyInfo = item.PropertyInfo, + PropertyName = item.PropertyName + }; + columns.Add(item); + } + } + result.Columns = columns; + return result; + } + private void InitMppingInfo(EntityInfo entityInfo) { if (this.Context.MappingTables == null)