Beispiel #1
0
        private static void ConfigureAnnotations(EdmType toTable, IDictionary <string, object> annotations)
        {
            foreach (var annotation in annotations)
            {
                var name = XmlConstants.CustomAnnotationPrefix + annotation.Key;
                var existingAnnotation = toTable.Annotations.FirstOrDefault(
                    a => a.Name == name && !Equals(a.Value, annotation.Value));
                if (existingAnnotation != null)
                {
                    throw new InvalidOperationException(
                              Strings.ConflictingTypeAnnotation(annotation.Key, annotation.Value, existingAnnotation.Value, toTable.Name));
                }

                toTable.AddAnnotation(name, annotation.Value);
            }
        }
Beispiel #2
0
 private static void ConfigureAnnotations(
     EdmType toTable,
     IDictionary <string, object> annotations)
 {
     foreach (KeyValuePair <string, object> annotation1 in (IEnumerable <KeyValuePair <string, object> >)annotations)
     {
         KeyValuePair <string, object> annotation = annotation1;
         string           name             = "http://schemas.microsoft.com/ado/2013/11/edm/customannotation:" + annotation.Key;
         MetadataProperty metadataProperty = toTable.Annotations.FirstOrDefault <MetadataProperty>((Func <MetadataProperty, bool>)(a =>
         {
             if (a.Name == name)
             {
                 return(!object.Equals(a.Value, annotation.Value));
             }
             return(false);
         }));
         if (metadataProperty != null)
         {
             throw new InvalidOperationException(Strings.ConflictingTypeAnnotation((object)annotation.Key, annotation.Value, metadataProperty.Value, (object)toTable.Name));
         }
         toTable.AddAnnotation(name, annotation.Value);
     }
 }