Exemple #1
0
        private void SetAnnotationValue(IEdmElement element, string namespaceName, string localName, object value, ref VersioningDictionary <IEdmElement, object> annotationsDictionary)
        {
            object transientAnnotations = EdmDirectValueAnnotationsManager.GetTransientAnnotations(element, annotationsDictionary);
            object obj = transientAnnotations;

            EdmDirectValueAnnotationsManager.SetAnnotation(this.GetAttachedAnnotations(element), ref transientAnnotations, namespaceName, localName, value);
            if (transientAnnotations != obj)
            {
                annotationsDictionary = annotationsDictionary.Set(element, transientAnnotations);
            }
        }
Exemple #2
0
        public IEnumerable <IEdmDirectValueAnnotation> GetDirectValueAnnotations(IEdmElement element)
        {
            VersioningDictionary <IEdmElement, object> versioningDictionary = this.annotationsDictionary;
            IEnumerable <IEdmDirectValueAnnotation>    attachedAnnotations  = this.GetAttachedAnnotations(element);
            object obj = EdmDirectValueAnnotationsManager.GetTransientAnnotations(element, versioningDictionary);

            if (attachedAnnotations != null)
            {
                foreach (IEdmDirectValueAnnotation attachedAnnotation in attachedAnnotations)
                {
                    if (EdmDirectValueAnnotationsManager.IsDead(attachedAnnotation.NamespaceUri, attachedAnnotation.Name, obj))
                    {
                        continue;
                    }
                    yield return(attachedAnnotation);
                }
            }
            foreach (IEdmDirectValueAnnotation edmDirectValueAnnotation in EdmDirectValueAnnotationsManager.TransientAnnotations(obj))
            {
                yield return(edmDirectValueAnnotation);
            }
        }
Exemple #3
0
        private object GetAnnotationValue(IEdmElement element, string namespaceName, string localName, VersioningDictionary <IEdmElement, object> annotationsDictionary)
        {
            object value;
            IEdmDirectValueAnnotation edmDirectValueAnnotation = EdmDirectValueAnnotationsManager.FindTransientAnnotation(EdmDirectValueAnnotationsManager.GetTransientAnnotations(element, annotationsDictionary), namespaceName, localName);

            if (edmDirectValueAnnotation == null)
            {
                IEnumerable <IEdmDirectValueAnnotation> attachedAnnotations = this.GetAttachedAnnotations(element);
                if (attachedAnnotations != null)
                {
                    IEnumerator <IEdmDirectValueAnnotation> enumerator = attachedAnnotations.GetEnumerator();
                    using (enumerator)
                    {
                        while (enumerator.MoveNext())
                        {
                            IEdmDirectValueAnnotation current = enumerator.Current;
                            if (!(current.NamespaceUri == namespaceName) || !(current.Name == localName))
                            {
                                continue;
                            }
                            value = current.Value;
                            return(value);
                        }
                        return(null);
                    }
                    return(value);
                }
                return(null);
            }
            else
            {
                return(edmDirectValueAnnotation.Value);
            }
        }