/// <summary> /// Ensure the destination instance path is valid when nulls are encountered along the path. /// </summary> /// <param name="instance"></param> /// <param name="property"></param> /// <param name="index"></param> bool EnsureDestinationInstance(ModelInstance instance, ModelReferenceProperty property, int index) { if (property.IsList) { ModelInstanceList list = instance.GetList(property); for (int i = list.Count; i <= index; i++) { list.Add(property.PropertyType.Create()); } } else { instance.SetReference(property, property.PropertyType.Create()); } return(true); }
/// <summary> /// Ensure the destination instance path is valid when nulls are encountered along the path. /// </summary> /// <param name="instance"></param> /// <param name="property"></param> /// <param name="index"></param> bool EnsureDestinationInstance(ModelInstance instance, ModelReferenceProperty property, int index) { if (property.IsList) { ModelInstanceList list = instance.GetList(property); for (int i = list.Count; i <= index; i++) list.Add(property.PropertyType.Create()); } else instance.SetReference(property, property.PropertyType.Create()); return true; }