|
|
@ -138,69 +138,43 @@ namespace Apewer.Source |
|
|
|
} |
|
|
|
if (attribute == null) continue; |
|
|
|
|
|
|
|
// 读取值。
|
|
|
|
var value = query.Value(r, attribute.Field); |
|
|
|
if (value == null) continue; |
|
|
|
if (value.Equals(DBNull.Value)) continue; |
|
|
|
|
|
|
|
// 根据属性类型设置值。
|
|
|
|
var pt = property.PropertyType; |
|
|
|
if (pt.Equals(typeof(object)) || pt.Equals(typeof(Nullable<DateTime>))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { query.Value(r, attribute.Field) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(DateTime))) |
|
|
|
{ |
|
|
|
var value = query.Value(r, attribute.Field); |
|
|
|
if (value != null) setter.Invoke(record, new object[] { query.Value(r, attribute.Field) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(byte[]))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { (byte[])query.Value(r, attribute.Field) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(byte))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Byte(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(sbyte))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { SByte(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(short))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Int16(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(ushort))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { UInt16(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(int))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Int32(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(uint))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { UInt32(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(long))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Int64(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(ulong))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { UInt64(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(float))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Single(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(double))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Double(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(decimal))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { Decimal(query.Text(r, attribute.Field)) }); |
|
|
|
} |
|
|
|
else if (pt.Equals(typeof(string))) |
|
|
|
{ |
|
|
|
setter.Invoke(record, new object[] { query.Text(r, attribute.Field) }); |
|
|
|
} |
|
|
|
if (pt.Equals(typeof(object))) setter.Invoke(record, new object[] { value }); |
|
|
|
else if (pt.Equals(typeof(byte[]))) setter.Invoke(record, new object[] { (byte[])value }); |
|
|
|
else if (pt.Equals(typeof(string))) setter.Invoke(record, new object[] { value.ToString() }); |
|
|
|
|
|
|
|
else if (pt.Equals(typeof(DateTime))) setter.Invoke(record, new object[] { value }); |
|
|
|
else if (pt.Equals(typeof(byte))) setter.Invoke(record, new object[] { Byte(value) }); |
|
|
|
else if (pt.Equals(typeof(sbyte))) setter.Invoke(record, new object[] { SByte(value) }); |
|
|
|
else if (pt.Equals(typeof(short))) setter.Invoke(record, new object[] { Int16(value) }); |
|
|
|
else if (pt.Equals(typeof(ushort))) setter.Invoke(record, new object[] { UInt16(value) }); |
|
|
|
else if (pt.Equals(typeof(int))) setter.Invoke(record, new object[] { Int32(value) }); |
|
|
|
else if (pt.Equals(typeof(uint))) setter.Invoke(record, new object[] { UInt32(value) }); |
|
|
|
else if (pt.Equals(typeof(long))) setter.Invoke(record, new object[] { Int64(value) }); |
|
|
|
else if (pt.Equals(typeof(ulong))) setter.Invoke(record, new object[] { UInt64(value) }); |
|
|
|
else if (pt.Equals(typeof(float))) setter.Invoke(record, new object[] { Single(value) }); |
|
|
|
else if (pt.Equals(typeof(double))) setter.Invoke(record, new object[] { Double(value) }); |
|
|
|
else if (pt.Equals(typeof(decimal))) setter.Invoke(record, new object[] { Decimal(value) }); |
|
|
|
|
|
|
|
else if (pt.Equals(typeof(Nullable<DateTime>))) setter.Invoke(record, new object[] { new Nullable<DateTime>((DateTime)value) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<byte>))) setter.Invoke(record, new object[] { new Nullable<byte>(Byte(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<sbyte>))) setter.Invoke(record, new object[] { new Nullable<sbyte>(SByte(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<short>))) setter.Invoke(record, new object[] { new Nullable<short>(Int16(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<ushort>))) setter.Invoke(record, new object[] { new Nullable<int>(UInt16(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<int>))) setter.Invoke(record, new object[] { new Nullable<int>(Int32(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<uint>))) setter.Invoke(record, new object[] { new Nullable<uint>(UInt32(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<long>))) setter.Invoke(record, new object[] { new Nullable<long>(Int64(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<ulong>))) setter.Invoke(record, new object[] { new Nullable<ulong>(UInt64(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<float>))) setter.Invoke(record, new object[] { new Nullable<float>(Single(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<double>))) setter.Invoke(record, new object[] { new Nullable<double>(Double(value) ) }); |
|
|
|
else if (pt.Equals(typeof(Nullable<decimal>))) setter.Invoke(record, new object[] { new Nullable<decimal>(Decimal(value) ) }); |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
try |
|
|
|