/// <summary> /// Sets or creates new preset item, with data annotations taken from the specified column /// </summary> /// <param name="column">The column.</param> /// <param name="skipExistingAnnotations">if set to <c>true</c> [skip existing annotations].</param> /// <returns>Created or updated preset item</returns> public propertyAnnotationPresetItem SetFrom(DataColumn column, Boolean skipExistingAnnotations = true) { var item = GetAnnotationPresetItem(column); if (item == defaultItem) { item = new propertyAnnotationPresetItem(column); items.Add(item); return(item); } else { item.SetFrom(column, skipExistingAnnotations); return(item); } }
/// <summary> /// Sets or creates new preset item, with data annotations taken from the specified column /// </summary> /// <param name="property">The property entry to learn from.</param> /// <param name="skipExistingAnnotations">if set to <c>true</c> [skip existing annotations].</param> /// <returns>Created or updated preset item</returns> public propertyAnnotationPresetItem SetFrom(settingsPropertyEntry property, Boolean skipExistingAnnotations = true) { var item = GetAnnotationPresetItem(property.name); if (item == defaultItem) { item = new propertyAnnotationPresetItem(); item.SetFrom(property, skipExistingAnnotations); items.Add(item); return(item); } else { item.SetFrom(property, skipExistingAnnotations); return(item); } }
/// <summary> /// Manual creation of new preset item definition /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="displayName">The display name for the property.</param> /// <param name="description">The description, attached to the property</param> /// <returns></returns> public propertyAnnotationPresetItem AddAnnotationPresetItem(String propertyName, String displayName = "", String description = "") { propertyAnnotationPresetItem output = new propertyAnnotationPresetItem() { name = propertyName }; if (displayName.isNullOrEmpty()) { displayName = propertyName.imbTitleCamelOperation(true); } if (!description.isNullOrEmpty()) { output.definitions.Add(templateFieldDataTable.col_desc, description); } output.definitions.Add(templateFieldDataTable.col_caption, displayName); return(output); }