mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
Enum Fix
This commit is contained in:
parent
acc2a546cf
commit
ca859b3433
@ -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)
|
||||
|
@ -6,7 +6,7 @@
|
||||
<Copyright>Ahmed Kh. Zamil</Copyright>
|
||||
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>2.2.9</Version>
|
||||
<Version>2.3.0</Version>
|
||||
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
|
||||
<Authors>Ahmed Kh. Zamil</Authors>
|
||||
<AssemblyVersion></AssemblyVersion>
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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<DistributedConnection>("iip://localhost", new { AutoReconnect = true });
|
||||
|
||||
//dynamic remote = await Warehouse.Get<IResource>("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<PropertyInfo> GetOrderedProperties(Type type)
|
||||
{
|
||||
Dictionary<Type, int> lookup = new Dictionary<Type, int>();
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user