示例#1
0
        private static void AddArray(object item, PropertyInfo property, KOModel model, bool observable)
        {
            var listType = GetListType(property.PropertyType);

            if (IsSimpleType(listType))
            {
                dynamic list = property.GetValue(item) ?? new List <object>();
                model.AddArray(ToJavascriptName(property), list, observable);
            }
            else
            {
                var list = property.GetValue(item) as IEnumerable <object> ?? new List <object>();
                model.AddArray(ToJavascriptName(property), list.Select(x => x.ToKO()), observable);
            }
        }
示例#2
0
        public static KOModel ToKO(this IEnumerable <object> list, string name)
        {
            var model = new KOModel();

            model.AddArray(name, list.Select(item => ToKO((object)item)).ToList(), true);
            return(model);
        }
示例#3
0
 public static KOModel ToKO(this IEnumerable<object> list, string name)
 {
     var model = new KOModel();
     model.AddArray(name, list.Select(item => ToKO((object) item)).ToList(), true);
     return model;
 }
示例#4
-1
 private static void AddArray(object item, PropertyInfo property, KOModel model, bool observable)
 {
     var listType = GetListType(property.PropertyType);
     if (IsSimpleType(listType))
     {
         dynamic list = property.GetValue(item) ?? new List<object>();
         model.AddArray(ToJavascriptName(property), list, observable);
     }
     else
     {
         var list = property.GetValue(item) as IEnumerable<object> ?? new List<object>();
         model.AddArray(ToJavascriptName(property), list.Select(x => x.ToKO()), observable);
     }
 }