2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 22:48:42 +00:00

runtimeType

This commit is contained in:
2026-06-09 04:31:56 +03:00
parent a741013621
commit daf7f09a12
7 changed files with 80 additions and 22 deletions
+8 -5
View File
@@ -380,9 +380,11 @@ public static class DataSerializer
var typeDef = warehouse.GetLocalTypeDefByType(valueType);
var intVal = Convert.ChangeType(value, (value as Enum).GetTypeCode());
//var intVal = Convert.ChangeType(value, (value as Enum).GetTypeCode());
var intVal = Convert.ToInt32((Enum)value);//, (value as Enum).GetTypeCode());
var ct = typeDef.Constants.FirstOrDefault(x => x.Value.Equals(intVal));
//var ct = typeDef.Constants.FirstOrDefault(x => x.Value.Equals(intVal));
var ct = typeDef.Constants.FirstOrDefault(x => Convert.ToInt32(x.Value) == intVal);
if (ct == null)
return new Tdu(TduIdentifier.Null, null, 0, null, null);
@@ -718,8 +720,8 @@ public static class DataSerializer
var all = DC.Combine(keysTdu, 0, (uint)keysTdu.Length, valuesTdu, 0, (uint)valuesTdu.Length);
return new Tdu(TduIdentifier.Typed, all, (uint)all.Length,
new TruComposite(TruIdentifier.TypedMap, false, new Tru[] { kt, vt },
value.GetType()),
new TruComposite(TruIdentifier.TypedMap, false, new Tru[] { kt, vt },
value.GetType()),
connection);
@@ -864,7 +866,7 @@ public static class DataSerializer
var rt = new List<byte>();
var record = (IRecord)value;
var recordTru = Tru.FromType(value.GetType(), warehouse) ;
var recordTru = Tru.FromType(value.GetType(), warehouse);
TypeDef typeDef = null;
@@ -882,6 +884,7 @@ public static class DataSerializer
throw new Exception("Unsupported.");
}
foreach (var pt in typeDef.Properties)
{
var propValue = pt.PropertyInfo.GetValue(record, null);