public void Can_get_and_set_annotations() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var dataModelAnnotation = new DataModelAnnotation(); Assert.Empty(entityType.Annotations); entityType.Annotations.Add(dataModelAnnotation); Assert.Same(dataModelAnnotation, entityType.Annotations.Single()); }
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; }