示例#1
0
        private IEdmVocabularyAnnotation WrapVocabularyAnnotation(CsdlVocabularyAnnotationBase annotation, CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, string qualifier)
        {
            CsdlSemanticsVocabularyAnnotation annotation2;

            if (!this.wrappedAnnotations.TryGetValue(annotation, out annotation2))
            {
                CsdlValueAnnotation annotation3 = annotation as CsdlValueAnnotation;
                annotation2 = (annotation3 != null) ? ((CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsValueAnnotation(schema, targetContext, annotationsContext, annotation3, qualifier)) : ((CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsTypeAnnotation(schema, targetContext, annotationsContext, (CsdlTypeAnnotation)annotation, qualifier));
                this.wrappedAnnotations[annotation] = annotation2;
            }
            return(annotation2);
        }
示例#2
0
 private IEdmVocabularyAnnotation WrapVocabularyAnnotation(CsdlVocabularyAnnotationBase annotation, CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, string qualifier)
 {
     return(EdmUtil.DictionaryGetOrUpdate(
                this.wrappedAnnotations,
                annotation,
                ann =>
     {
         CsdlValueAnnotation valueAnnotation = ann as CsdlValueAnnotation;
         return
         valueAnnotation != null
                 ? (CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsValueAnnotation(schema, targetContext, annotationsContext, valueAnnotation, qualifier)
                 : (CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsTypeAnnotation(schema, targetContext, annotationsContext, (CsdlTypeAnnotation)annotation, qualifier);
     }));
 }
        private IEdmVocabularyAnnotation WrapVocabularyAnnotation(CsdlVocabularyAnnotationBase annotation, CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, string qualifier)
        {
            CsdlSemanticsVocabularyAnnotation result;

            // Guarantee that multiple calls to wrap a given annotation all return the same object.
            if (this.wrappedAnnotations.TryGetValue(annotation, out result))
            {
                return(result);
            }

            CsdlValueAnnotation valueAnnotation = annotation as CsdlValueAnnotation;

            result =
                valueAnnotation != null
                ? (CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsValueAnnotation(schema, targetContext, annotationsContext, valueAnnotation, qualifier)
                : (CsdlSemanticsVocabularyAnnotation) new CsdlSemanticsTypeAnnotation(schema, targetContext, annotationsContext, (CsdlTypeAnnotation)annotation, qualifier);

            this.wrappedAnnotations[annotation] = result;
            return(result);
        }
示例#4
0
 private static void AddLabeledExpressions(IEnumerable <CsdlVocabularyAnnotationBase> annotations, Dictionary <string, object> result)
 {
     foreach (CsdlVocabularyAnnotationBase base2 in annotations)
     {
         CsdlValueAnnotation annotation = base2 as CsdlValueAnnotation;
         if (annotation != null)
         {
             AddLabeledExpressions(annotation.Expression, result);
         }
         else
         {
             CsdlTypeAnnotation annotation2 = base2 as CsdlTypeAnnotation;
             if (annotation2 != null)
             {
                 foreach (CsdlPropertyValue value2 in annotation2.Properties)
                 {
                     AddLabeledExpressions(value2.Expression, result);
                 }
             }
         }
     }
 }
示例#5
0
 private static void AddLabeledExpressions(IEnumerable <CsdlVocabularyAnnotationBase> annotations, Dictionary <string, object> result)
 {
     foreach (CsdlVocabularyAnnotationBase sourceAnnotation in annotations)
     {
         CsdlValueAnnotation valueAnnotation = sourceAnnotation as CsdlValueAnnotation;
         if (valueAnnotation != null)
         {
             AddLabeledExpressions(valueAnnotation.Expression, result);
         }
         else
         {
             CsdlTypeAnnotation typeAnnotation = sourceAnnotation as CsdlTypeAnnotation;
             if (typeAnnotation != null)
             {
                 foreach (CsdlPropertyValue property in typeAnnotation.Properties)
                 {
                     AddLabeledExpressions(property.Expression, result);
                 }
             }
         }
     }
 }
 public CsdlSemanticsValueAnnotation(CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, CsdlValueAnnotation annotation, string externalQualifier)
     : base(schema, targetContext, annotationsContext, annotation, externalQualifier)
 {
 }
 public CsdlSemanticsValueAnnotation(CsdlSemanticsSchema schema, IEdmVocabularyAnnotatable targetContext, CsdlSemanticsAnnotations annotationsContext, CsdlValueAnnotation annotation, string externalQualifier) : base(schema, targetContext, annotationsContext, annotation, externalQualifier)
 {
     this.valueCache = new Cache <CsdlSemanticsValueAnnotation, IEdmExpression>();
 }