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
|
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);
|
template.Properties[i].PropertyInfo.SetValue(record, v);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<Copyright>Ahmed Kh. Zamil</Copyright>
|
<Copyright>Ahmed Kh. Zamil</Copyright>
|
||||||
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>2.2.9</Version>
|
<Version>2.3.0</Version>
|
||||||
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
|
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
|
||||||
<Authors>Ahmed Kh. Zamil</Authors>
|
<Authors>Ahmed Kh. Zamil</Authors>
|
||||||
<AssemblyVersion></AssemblyVersion>
|
<AssemblyVersion></AssemblyVersion>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -590,7 +590,8 @@ public class TypeTemplate
|
|||||||
|
|
||||||
if (classIsPublic)
|
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
|
.Where(x => x.MemberType == MemberTypes.Property || x.MemberType == MemberTypes.Field
|
||||||
|| x.MemberType == MemberTypes.Event || x.MemberType == MemberTypes.Method)
|
|| x.MemberType == MemberTypes.Event || x.MemberType == MemberTypes.Method)
|
||||||
.Where(x => !(x is FieldInfo c && !c.IsStatic))
|
.Where(x => !(x is FieldInfo c && !c.IsStatic))
|
||||||
|
@ -55,10 +55,6 @@ namespace Test
|
|||||||
static async Task Main(string[] args)
|
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.
|
// Create stores to keep objects.
|
||||||
var system = await Warehouse.Put("sys", new MemoryStore());
|
var system = await Warehouse.Put("sys", new MemoryStore());
|
||||||
var server = await Warehouse.Put("sys/server", new DistributedServer());
|
var server = await Warehouse.Put("sys/server", new DistributedServer());
|
||||||
@ -106,12 +102,10 @@ namespace Test
|
|||||||
|
|
||||||
private static async void TestClient(IResource local)
|
private static async void TestClient(IResource local)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var con = await Warehouse.Get<DistributedConnection>("iip://localhost", new { AutoReconnect = true });
|
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");
|
dynamic remote = await con.Get("sys/service");
|
||||||
|
|
||||||
var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow);
|
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