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); } }
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); } }