public static AttributeDescription GetEntityCaptionAttribute(EntityMetadata metadata) { string[] columnCaptions = new string[] { "Code", "IdNumber", "NumberId", "Number", "Name", "Caption", "Id" }; int i = -1; var properties = metadata.PlainAttributes.Select(pa => pa.PropertyName); while (++i < columnCaptions.Count() && !properties.Contains(columnCaptions[i])) { } return i < columnCaptions.Count() ? metadata.GetAttributeByPropertyName(columnCaptions[i]) : null; }
public static AttributeDescription GetEntityCaptionAttribute(EntityMetadata metadata) { string[] columnCaptions = new string[] { "Code", "IdNumber", "NumberId", "Number", "Name", "Caption", "Id" }; int i = -1; var properties = metadata.PlainAttributes.Select(pa => pa.PropertyName); while (++i < columnCaptions.Count() && !properties.Contains(columnCaptions[i])) { } return(i < columnCaptions.Count() ? metadata.GetAttributeByPropertyName(columnCaptions[i]) : null); }