Ejemplo n.º 1
0
        private static IDataNode BuildUserTypeDataNode(Type type)
        {
            ValidateUserTypeHasConstructor(type);

            IReadOnlyList <IEdge> edges = type.GetProperties()
                                          .Select(p => SerializableProperty.For(p))
                                          .Where(p => p != null)
                                          .OrderBy(p => p.Order)
                                          .Also(ps => ValidateSerializableProperties(type, ps))
                                          .Select(p => BuildEdge(p.PropertyInfo))
                                          .ToList();

            return((IDataNode)typeof(UserTypeDataNode <>)
                   .MakeGenericType(type)
                   .GetConstructor(new Type[] { typeof(IReadOnlyList <IEdge>) }).Invoke(new object[] { edges }));
        }