public static void SetAnnotation( this ICollection <DataModelAnnotation> dataModelAnnotations, string name, object value) { DebugCheck.NotNull(dataModelAnnotations); DebugCheck.NotEmpty(name); DebugCheck.NotNull(value); var annotation = dataModelAnnotations.SingleOrDefault(a => a.Name.Equals(name, StringComparison.Ordinal)); if (annotation == null) { dataModelAnnotations.Add( annotation = new DataModelAnnotation { Name = name }); } annotation.Value = value; }
protected virtual void VisitAnnotation(DataModelAnnotation item) { }
public static bool TryGetByName(this IEnumerable <DataModelAnnotation> list, string itemName, out DataModelAnnotation result) { foreach (var listItem in list) { if (listItem != null && string.Equals(listItem.Name, itemName, StringComparison.Ordinal)) { result = listItem; return(true); } } result = default(DataModelAnnotation); return(false); }