예제 #1
0
 internal EdmModelCsdlSerializationVisitor(IEdmModel model, XmlWriter xmlWriter, Version edmVersion)
     : base(model)
 {
     this.edmVersion             = edmVersion;
     this.namespaceAliasMappings = model.GetNamespaceAliases();
     this.schemaWriter           = new EdmModelCsdlSchemaWriter(model, this.namespaceAliasMappings, xmlWriter, this.edmVersion);
 }
 internal EdmModelCsdlSerializationVisitor(IEdmModel model, XmlWriter xmlWriter, Version edmVersion) : base(model)
 {
     this.navigationProperties   = new List <IEdmNavigationProperty>();
     this.associations           = new Dictionary <string, List <IEdmNavigationProperty> >();
     this.associationSets        = new Dictionary <string, List <TupleInternal <IEdmEntitySet, IEdmNavigationProperty> > >();
     this.edmVersion             = edmVersion;
     this.namespaceAliasMappings = model.GetNamespaceAliases();
     this.schemaWriter           = new EdmModelCsdlSchemaWriter(model, this.namespaceAliasMappings, xmlWriter, this.edmVersion);
 }
        internal void WriteSchemaElementHeader(EdmSchema schema, string alias, IEnumerable <KeyValuePair <string, string> > mappings)
        {
            string csdlNamespace = EdmModelCsdlSchemaWriter.GetCsdlNamespace(this.version);

            this.xmlWriter.WriteStartElement("Schema", csdlNamespace);
            this.WriteOptionalAttribute <string>("Namespace", schema.Namespace, string.Empty, new Func <string, string>(EdmValueWriter.StringAsXml));
            this.WriteOptionalAttribute <string>("Alias", alias, new Func <string, string>(EdmValueWriter.StringAsXml));
            if (mappings != null)
            {
                foreach (KeyValuePair <string, string> mapping in mappings)
                {
                    this.xmlWriter.WriteAttributeString("xmlns", mapping.Key, null, mapping.Value);
                }
            }
        }
 internal void WritePathExpressionElement(IEdmPathExpression expression)
 {
     this.xmlWriter.WriteStartElement("Path");
     this.xmlWriter.WriteString(EdmModelCsdlSchemaWriter.PathAsXml(expression.Path));
     this.WriteEndElement();
 }