예제 #1
0
        protected internal override void VisitEdmAssociationType(AssociationType item)
        {
            StringBuilder builder = new StringBuilder();

            EdmSerializationVisitor.AppendSchemaErrors(builder, (MetadataItem)item);
            if (MetadataItemHelper.IsInvalid((MetadataItem)item))
            {
                this.AppendMetadataItem <AssociationType>(builder, item, (Action <EdmSerializationVisitor, AssociationType>)((v, i) => v.InternalVisitEdmAssociationType(i)));
                this.WriteComment(builder.ToString());
            }
            else
            {
                this.WriteComment(builder.ToString());
                this.InternalVisitEdmAssociationType(item);
            }
        }
예제 #2
0
        private void AppendMetadataItem <T>(
            StringBuilder builder,
            T item,
            Action <EdmSerializationVisitor, T> visitAction)
            where T : MetadataItem
        {
            XmlWriterSettings settings = new XmlWriterSettings()
            {
                ConformanceLevel = ConformanceLevel.Fragment,
                Indent           = true
            };

            settings.NewLineChars += "        ";
            builder.Append(settings.NewLineChars);
            using (XmlWriter xmlWriter = XmlWriter.Create(builder, settings))
            {
                EdmSerializationVisitor serializationVisitor = new EdmSerializationVisitor(this._schemaWriter.Replicate(xmlWriter));
                visitAction(serializationVisitor, item);
            }
        }