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

@ -35,6 +35,7 @@ using System.Linq;
using System.Reflection;
using Esyur.Resource.Template;
using System.Runtime.CompilerServices;
using System.Collections;
namespace Esyur.Data
{
@ -1171,6 +1172,8 @@ namespace Esyur.Data
if (value is IUserType)
value = (value as IUserType).Get();
// value = (List<>)value.ToArray();
if (value is Func<DistributedConnection, object>)
//if (connection != null)
@ -1188,8 +1191,22 @@ namespace Esyur.Data
var t = value.GetType();
// Convert ICollection<T> to Array<T>
if (!t.IsArray && typeof(ICollection).IsAssignableFrom(t))
{
var col = t.GetInterfaces().Where(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(ICollection<>));
if (col.Count() == 0)
return (DataType.Void, null);
var elementType = col.First().GetGenericArguments()[0];
value = new ArrayList((ICollection)value).ToArray(elementType);
t = value.GetType();
}
var isArray = t.IsArray;
if (isArray)
t = t.GetElementType();