Example #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);
            }
        }
Example #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);
        }
Example #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;
 }
Example #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);
     }
 }