2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00

EntityCore

This commit is contained in:
2020-02-15 11:21:28 +03:00
parent 3205499747
commit 7a21f6a928
27 changed files with 962 additions and 830 deletions

View File

@ -501,10 +501,9 @@ namespace Esyur.Resource
}
public static T New<T>(string name, IStore store = null, IResource parent = null, IPermissionsManager manager = null, Structure attributes = null, Structure arguments = null, Structure properties = null)
where T : IResource
public static IResource New(Type type, string name, IStore store = null, IResource parent = null, IPermissionsManager manager = null, Structure attributes = null, Structure arguments = null, Structure properties = null)
{
var type = ResourceProxy.GetProxy<T>();
type = ResourceProxy.GetProxy(type);
/*
@ -544,7 +543,7 @@ namespace Esyur.Resource
{
foreach (var p in properties)
{
var pi = typeof(T).GetProperty(p.Key, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly);
var pi = type.GetProperty(p.Key, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly);
if (pi != null)
pi.SetValue(res, p.Value);
}
@ -553,7 +552,14 @@ namespace Esyur.Resource
if (store != null || parent != null || res is IStore)
Put(res, name, store, parent, null, 0, manager, attributes);
return (T)res;
return res;
}
public static T New<T>(string name, IStore store = null, IResource parent = null, IPermissionsManager manager = null, Structure attributes = null, Structure arguments = null, Structure properties = null)
where T : IResource
{
return (T)New(typeof(T), name, store, parent, manager, attributes, arguments, properties);
}
/// <summary>