public static bool TryParseToTargetPropertyType(string value, PropertyInfo propInfo, out object parsedValue, out bool hasNewEntityIndicator, string format = null, bool returnNullEvenIfNonNullable = false) { hasNewEntityIndicator = false; if (string.IsNullOrEmpty(format)) { var displayFormatAtt = (DisplayFormatAttribute)ReflectionHelper.GetPropertyAttribute(propInfo, typeof(DisplayFormatAttribute)); if (displayFormatAtt != null) { if (displayFormatAtt.ApplyFormatInEditMode && !string.IsNullOrEmpty(displayFormatAtt.DataFormatString)) { format = displayFormatAtt.DataFormatString; } } } var generalDataType = EntityExtensions.GetGeneralDataType(propInfo); switch (generalDataType) { case GeneralDataType.Enum: return(TryParseToEnumPropertyType(value, propInfo, out parsedValue, returnNullEvenIfNonNullable)); case GeneralDataType.ReferenceList: return(TryParseToReferenceListPropertyType(value, propInfo, out parsedValue, returnNullEvenIfNonNullable)); case GeneralDataType.MultiValueReferenceList: return(TryParseToMultiValueReferenceListPropertyType(value, propInfo, out parsedValue)); case GeneralDataType.EntityReference: return(TryParseToEntityReferencePropertyType(value, propInfo, out parsedValue, out hasNewEntityIndicator)); default: return(TryParseToValueTypePropertyType(value, propInfo, out parsedValue, format, returnNullEvenIfNonNullable)); } }
internal static bool TryParseToValueTypePropertyType(string value, PropertyInfo propInfo, out object parsedValue, string format = null, bool returnNullEvenIfNonNullable = false) { var generalDataType = EntityExtensions.GetGeneralDataType(propInfo); return(TryParseToValueTypePropertyType(value, propInfo, generalDataType, out parsedValue, format, returnNullEvenIfNonNullable)); }