internal void WriteIncludeAnnotationsElement(IEdmIncludeAnnotations includeAnnotations)
 {
     // e.g. <edmx:IncludeAnnotations ... />
     this.xmlWriter.WriteStartElement(CsdlConstants.Prefix_Edmx, CsdlConstants.Element_IncludeAnnotations, this.edmxNamespace);
     this.WriteRequiredAttribute(CsdlConstants.Attribute_TermNamespace, includeAnnotations.TermNamespace, EdmValueWriter.StringAsXml);
     this.WriteOptionalAttribute(CsdlConstants.Attribute_Qualifier, includeAnnotations.Qualifier, EdmValueWriter.StringAsXml);
     this.WriteOptionalAttribute(CsdlConstants.Attribute_TargetNamespace, includeAnnotations.TargetNamespace, EdmValueWriter.StringAsXml);
     this.xmlWriter.WriteEndElement();
 }
Esempio n. 2
0
        public void ParseIncludeAnnotationsWorksAsExpected()
        {
            string json = @" {
  ""$TermNamespace"": ""org.example.hcm"",
  ""$Qualifier"": ""Tablet"",
  ""$TargetNamespace"":   ""com.example.Person""  }";

            Utf8JsonReader jsonReader = GetJsonReader(json);

            using (JsonDocument document = JsonDocument.Parse(json))
            {
                JsonElement rootElement = document.RootElement;

                JsonParserContext      context            = new JsonParserContext();
                IEdmIncludeAnnotations includeAnnotations = CsdlJsonParser.ParseIncludeAnnotations(rootElement, context);

                Assert.NotNull(includeAnnotations);
                Assert.Equal("org.example.hcm", includeAnnotations.TermNamespace);
                Assert.Equal("Tablet", includeAnnotations.Qualifier);
                Assert.Equal("com.example.Person", includeAnnotations.TargetNamespace);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Add IncludeAnnotations information.
 /// </summary>
 /// <param name="edmIncludeAnnotations">The IEdmIncludeAnnotations.</param>
 public void AddIncludeAnnotations(IEdmIncludeAnnotations edmIncludeAnnotations)
 {
     this.includeAnnotations.Add(edmIncludeAnnotations);
 }
 /// <summary>
 /// Add IncludeAnnotations information.
 /// </summary>
 /// <param name="edmIncludeAnnotations">The IEdmIncludeAnnotations.</param>
 public void AddIncludeAnnotations(IEdmIncludeAnnotations edmIncludeAnnotations)
 {
     this.includeAnnotations.Add(edmIncludeAnnotations);
 }