public virtual ActionResult PropertyItemHtml(object data, string propertyPath, int depth, string pathPrefix) { ViewData["propertyPath"] = (pathPrefix ?? "") + propertyPath; ViewData["addDepth"] = depth - 1; string parentPath = propertyPath.Contains(".") ? propertyPath.UpToLast(".") : ""; string propertyName = (propertyPath.Contains(".") ? propertyPath.LastAfter(".") : propertyPath).UpTo("["); Type parentType = ReflectionX.GetPropertyTypeByPath(data.GetType(), parentPath); IList list = ReflectionX.GetPropertyValueByPath(data, propertyPath, true) as IList; var listProp = ReflectionX.GetPropertyByPath(data.GetType(), propertyPath); Type listType = listProp.PropertyType; if (listType.GetType().IsArray) { list = (IList)Array.CreateInstance(ReflectionX.ElementType(listType), 1); list[0] = CreateInstance(listType.GetElementType()); } else { list = (IList)Activator.CreateInstance(listType); list.Add(CreateInstance(ReflectionX.ElementType(listType))); } ViewData["list"] = list; var metadata = new DataAnnotationsModelMetadataProvider().GetMetadataForProperty(null, parentType, propertyName); ViewData["CollectionAdditionalValues"] = metadata.AdditionalValues; RouteData.DataTokens.Add("CancelProcessingHtml", true); return(PartialView(ConfigHelper.GetViewPath("LyniconPropertyItem.cshtml"), data)); }