private void SerialiseReferenceMappingInternal(TableReferenceMapping mapping, XmlWriter writer) { if (mapping.FromTable == null) { throw new ArgumentNullException("mapping", string.Format("mapping.FromTable cannot be null [{0}]", mapping.DisplayName)); } if (mapping.ToReference == null) { throw new ArgumentNullException("mapping", string.Format("mapping.ToReference cannot be null [{0}]", mapping.DisplayName)); } WriterHelper document = new WriterHelper(writer); using (document.Element("TableReferenceMapping")) { writer.WriteElementString("FromTable", mapping.FromTable.Name); writer.WriteElementString("FromSchema", mapping.FromTable.Schema); writer.WriteElementString("ToReference", mapping.ToReference.Identifier.ToString()); ProcessScriptBase(mapping, writer); } }
public void SerialiseRelationshipMappingInternal(RelationshipReferenceMapping mapping, XmlWriter writer) { if (mapping.FromRelationship == null) { //throw new ArgumentNullException("mapping", string.Format("mapping.FromRelationship cannot be null [{0}]", mapping.DisplayName)); return; } if (mapping.ToReference == null) { //throw new ArgumentNullException("mapping", string.Format("mapping.ToReference cannot be null [{0}]", mapping.DisplayName)); return; } WriterHelper document = new WriterHelper(writer); using (document.Element("RelationshipReferenceMapping")) { writer.WriteElementString("FromRelationship", mapping.FromRelationship.Identifier.ToString()); writer.WriteElementString("ToReference", mapping.ToReference.Identifier.ToString()); ProcessScriptBase(mapping, writer); } }
private void SerialiseComponentMappingInternal(ComponentMapping mapping, XmlWriter writer) { if (mapping.FromTable == null) { throw new ArgumentNullException("mapping", "mapping.FromTable cannot be null"); } if (mapping.ToComponent == null) { throw new ArgumentNullException("mapping", "mapping.ToComponent cannot be null"); } if (mapping.ToComponent.Specification == null) { throw new ArgumentNullException("mapping", "mapping.ToComponent.Specification cannot be null"); } if (mapping.ToComponent.ParentEntity == null) { throw new ArgumentNullException("mapping", "mapping.ToComponent.ParentEntity cannot be null"); } if (mapping.ToProperties == null) { throw new ArgumentException("ToProperties in Mapping cannot be null"); } if (mapping.FromColumns == null) { throw new ArgumentException("FromColumns in Mapping cannot be null"); } if (mapping.FromColumns.Count <= 0) { throw new ArgumentException("FromColumns in Mapping cannot be empty"); } if (mapping.ToProperties.Count <= 0) { throw new ArgumentException("ToProperties in Mapping cannot be empty"); } WriterHelper document = new WriterHelper(writer); using (document.Element("ComponentMapping")) { writer.WriteElementString("FromTable", mapping.FromTable.Name); writer.WriteElementString("FromSchema", mapping.FromTable.Schema); using (document.Element("ToComponent")) { writer.WriteAttributeString("specification", mapping.ToComponent.Specification.Name); writer.WriteAttributeString("parent-entity", mapping.ToComponent.ParentEntity.Name); writer.WriteAttributeString("name", mapping.ToComponent.Name); } using (document.Element("FromColumns")) foreach (var column in mapping.FromColumns) { writer.WriteElementString("Column", column.Name); } using (document.Element("ToProperties")) foreach (var property in mapping.ToProperties) { writer.WriteElementString("Property", property.RepresentedProperty.Name); } ProcessScriptBase(mapping, writer); } }