diff --git a/Esiur/Data/DataDeserializer.cs b/Esiur/Data/DataDeserializer.cs index dcb61d8..11ff5a4 100644 --- a/Esiur/Data/DataDeserializer.cs +++ b/Esiur/Data/DataDeserializer.cs @@ -176,7 +176,8 @@ public static class DataDeserializer { try { - var v = Convert.ChangeType(ar[i], template.Properties[i].PropertyInfo.PropertyType); + //var v = Convert.ChangeType(ar[i], template.Properties[i].PropertyInfo.PropertyType); + var v = DC.CastConvert(ar[i], template.Properties[i].PropertyInfo.PropertyType); template.Properties[i].PropertyInfo.SetValue(record, v); } catch (Exception ex) diff --git a/Esiur/Esiur.csproj b/Esiur/Esiur.csproj index 4519c97..fd2f955 100644 --- a/Esiur/Esiur.csproj +++ b/Esiur/Esiur.csproj @@ -6,7 +6,7 @@ Ahmed Kh. Zamil http://www.esiur.com true - 2.2.9 + 2.3.0 https://github.com/esiur/esiur-dotnet Ahmed Kh. Zamil diff --git a/Esiur/LICENSE b/Esiur/LICENSE index 5018e9d..8fbd9bf 100644 --- a/Esiur/LICENSE +++ b/Esiur/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2021 Esiur Foundation, Ahmed Kh. Zamil. +Copyright (c) 2017-2022 Esiur Foundation, Ahmed Kh. Zamil. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Esiur/Resource/Template/TypeTemplate.cs b/Esiur/Resource/Template/TypeTemplate.cs index 7ab6dec..2b01c67 100644 --- a/Esiur/Resource/Template/TypeTemplate.cs +++ b/Esiur/Resource/Template/TypeTemplate.cs @@ -590,7 +590,8 @@ public class TypeTemplate if (classIsPublic) { - var mis = type.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) + var mis = type.GetMembers(BindingFlags.Public | BindingFlags.Instance + | BindingFlags.DeclaredOnly | BindingFlags.Static) .Where(x => x.MemberType == MemberTypes.Property || x.MemberType == MemberTypes.Field || x.MemberType == MemberTypes.Event || x.MemberType == MemberTypes.Method) .Where(x => !(x is FieldInfo c && !c.IsStatic)) diff --git a/Test/Program.cs b/Test/Program.cs index ef616e1..2a170e8 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -55,10 +55,6 @@ namespace Test static async Task Main(string[] args) { - var ppp = GetOrderedProperties(typeof(MyChildResource)).ToArray(); - var childMethods = typeof(MyChildResource).GetMembers( BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance); - var parentMethods = typeof(MyResource).GetMethods(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance); - // Create stores to keep objects. var system = await Warehouse.Put("sys", new MemoryStore()); var server = await Warehouse.Put("sys/server", new DistributedServer()); @@ -106,12 +102,10 @@ namespace Test private static async void TestClient(IResource local) { + + var con = await Warehouse.Get("iip://localhost", new { AutoReconnect = true }); - //dynamic remote = await Warehouse.Get("iip://localhost/sys/service", new { AutoReconnect = true }); - - //var con = remote.Connection as DistributedConnection; - dynamic remote = await con.Get("sys/service"); var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow); @@ -229,26 +223,6 @@ namespace Test - - - public static IEnumerable GetOrderedProperties(Type type) - { - Dictionary lookup = new Dictionary(); - - int count = 0; - lookup[type] = count++; - Type parent = type.BaseType; - while (parent != null) - { - lookup[parent] = count; - count++; - parent = parent.BaseType; - } - - return type.GetProperties() - .OrderByDescending(prop => lookup[prop.DeclaringType]); - } - }