Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对象与目标类型不匹配错误修改 #13

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CYQ.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
<Compile Include="Table\Extension\Serializable.cs" />
<Compile Include="Table\FastToT.cs" />
<Compile Include="Table\MCellStruct.cs" />
<Compile Include="Table\MDataTable.cs" />
<Compile Include="Table\MDataTableJoin.cs" />
<Compile Include="Table\Extension\MDataView.cs" />
<Compile Include="Table\TableEnum.cs" />
Expand Down Expand Up @@ -198,8 +199,6 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Table\MDataRowCollection.cs" />
<Compile Include="Table\MDataTable.cs">
</Compile>
<Compile Include="Table\MDataTableBatchAction.cs" />
<Compile Include="Table\MDataTableFilter.cs">
<SubType>Code</SubType>
Expand Down
11 changes: 9 additions & 2 deletions Table/MDataRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,12 +1201,18 @@ public void LoadFrom(object entity, BreakOp op)
try
{
Type t = entity.GetType();
List<PropertyInfo> 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);
Expand All @@ -1217,15 +1223,15 @@ public void LoadFrom(object entity, BreakOp op)
{
TableName = t.Name;
}
List<PropertyInfo> pis = StaticTool.GetPropertyInfo(t);

if (pis != null)
{
foreach (PropertyInfo pi in pis)
{
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:
Expand All @@ -1246,6 +1252,7 @@ public void LoadFrom(object entity, BreakOp op)
continue;
}
break;

}
Set(index, propValue, 2);//����״̬Ӧ��ֵ���ã���Ϊ1�Dz��Եġ�
}
Expand Down