- 优化 ReadAnonymous 映射类型不一致的容错;

This commit is contained in:
28810
2019-11-29 17:56:06 +08:00
parent bfed0cd124
commit 27f053f00b
8 changed files with 395 additions and 6 deletions

View File

@ -124,7 +124,7 @@ namespace FreeSql.Internal
{
Property = dtoProp,
CsName = dtoProp.Name,
CsType = dtoProp.PropertyType,
CsType = trydtocol.CsType, // dtoProp.PropertyType,
MapType = trydtocol.Attribute.MapType
};
parent.Childs.Add(child);
@ -195,7 +195,7 @@ namespace FreeSql.Internal
{
Property = dtoProp,
CsName = dtoProp.Name,
CsType = dtoProp.PropertyType,
CsType = trydtocol.CsType, //dtoProp.PropertyType,
MapType = trydtocol.Attribute.MapType
};
parent.Childs.Add(child);
@ -227,11 +227,17 @@ namespace FreeSql.Internal
if (notRead)
{
++index;
if (parent.Property != null)
return Utils.GetDataReaderValue(parent.Property.PropertyType, null);
return Utils.GetDataReaderValue(parent.CsType, null);
}
if (parent.CsType == parent.MapType)
return Utils.GetDataReaderValue(parent.CsType, dr.GetValue(++index));
return Utils.GetDataReaderValue(parent.CsType, Utils.GetDataReaderValue(parent.MapType, dr.GetValue(++index)));
object objval = dr.GetValue(++index);
if (parent.CsType != parent.MapType)
objval = Utils.GetDataReaderValue(parent.MapType, objval);
objval = Utils.GetDataReaderValue(parent.CsType, objval);
if (parent.Property != null && parent.CsType != parent.Property.PropertyType)
objval = Utils.GetDataReaderValue(parent.Property.PropertyType, objval);
return objval;
}
switch (parent.ConsturctorType)
{