diff --git a/CYQ.Data.csproj b/CYQ.Data.csproj index f1752e3d..6d1356dd 100644 --- a/CYQ.Data.csproj +++ b/CYQ.Data.csproj @@ -139,6 +139,7 @@ + @@ -198,8 +199,6 @@ Code - - Code diff --git a/Table/MDataRow.cs b/Table/MDataRow.cs index e6a0adf5..84163742 100644 --- a/Table/MDataRow.cs +++ b/Table/MDataRow.cs @@ -1201,12 +1201,18 @@ public void LoadFrom(object entity, BreakOp op) try { Type t = entity.GetType(); + List pis = StaticTool.GetPropertyInfo(t); if (Columns.Count == 0) { MDataColumn mcs = TableSchema.GetColumns(t); MCellStruct ms = null; for (int i = 0; i < mcs.Count; i++) { + if (mcs[i].SqlType == SqlDbType.Variant) + { + pis.Remove(t.GetProperty(mcs[i].ColumnName)); + continue; + } ms = mcs[i]; MDataCell cell = new MDataCell(ref ms); Add(cell); @@ -1217,7 +1223,7 @@ public void LoadFrom(object entity, BreakOp op) { TableName = t.Name; } - List pis = StaticTool.GetPropertyInfo(t); + if (pis != null) { foreach (PropertyInfo pi in pis) @@ -1225,7 +1231,7 @@ public void LoadFrom(object entity, BreakOp op) int index = Columns.GetIndex(pi.Name); if (index > -1) { - object propValue = pi.GetValue(entity, null); + object propValue = entity.GetType().GetProperties()[index].GetValue(entity, null); switch (op) { case BreakOp.Null: @@ -1246,6 +1252,7 @@ public void LoadFrom(object entity, BreakOp op) continue; } break; + } Set(index, propValue, 2);//它的状态应该值设置,改为1是不对的。 }