/// <summary> /// Escreve os dados para XML. /// </summary> /// <param name="writer"></param> void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("xmlns", "i", null, Namespaces.SchemaInstance); writer.WriteAttributeString("xmlns", "q", null, Namespaces.Query); writer.WriteAttributeString("ActionId", ActionId.ToString()); writer.WriteAttributeString("Type", Type.ToString()); writer.WriteAttributeString("EntityFullName", EntityFullName); writer.WriteAttributeString("ProviderName", ProviderName ?? ""); writer.WriteAttributeString("RowVersion", (RowVersion.HasValue) ? RowVersion.ToString() : ""); writer.WriteAttributeString("CommandTimeout", CommandTimeout.ToString()); writer.WriteStartElement("Parameters", Namespaces.Data); if (Parameters != null) { foreach (System.Xml.Serialization.IXmlSerializable parameter in Parameters) { writer.WriteStartElement("Parameter", Namespaces.Data); parameter.WriteXml(writer); writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteStartElement("Conditional"); if (Conditional != null) { ((System.Xml.Serialization.IXmlSerializable)Conditional).WriteXml(writer); } writer.WriteEndElement(); writer.WriteStartElement("AlternativeActions"); foreach (System.Xml.Serialization.IXmlSerializable action in AlternativeActions) { writer.WriteStartElement("PersistenceAction", Namespaces.Data); action.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("BeforeActions"); foreach (System.Xml.Serialization.IXmlSerializable action in BeforeActions) { writer.WriteStartElement("PersistenceAction", Namespaces.Data); action.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("AfterActions"); foreach (System.Xml.Serialization.IXmlSerializable action in AfterActions) { writer.WriteStartElement("PersistenceAction", Namespaces.Data); action.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); WriteItem <Colosoft.Query.StoredProcedureName>(writer, "StoredProcedureName", _storedProcedureName ?? Colosoft.Query.StoredProcedureName.Empty); writer.WriteStartElement("Query"); if (Query != null) { ((System.Xml.Serialization.IXmlSerializable)Query).WriteXml(writer); } writer.WriteEndElement(); }
/// <summary> /// Serializa o objeto. /// </summary> /// <param name="writer"></param> public void Serialize(Serialization.IO.CompactWriter writer) { writer.Write(ActionId); writer.Write((int)Type); writer.Write(EntityFullName); writer.Write(ProviderName); writer.Write((RowVersion.HasValue) ? RowVersion.ToString() : ""); if (Parameters != null) { writer.Write(Parameters.Count); foreach (ICompactSerializable parameter in Parameters) { parameter.Serialize(writer); } } else { writer.Write(0); } if (Conditional != null) { writer.Write(true); ((ICompactSerializable)Conditional).Serialize(writer); } else { writer.Write(false); } writer.Write(AlternativeActions.Count); foreach (ICompactSerializable action in AlternativeActions) { action.Serialize(writer); } writer.Write(BeforeActions.Count); foreach (ICompactSerializable action in BeforeActions) { action.Serialize(writer); } writer.Write(AfterActions.Count); foreach (ICompactSerializable action in AfterActions) { action.Serialize(writer); } if (_storedProcedureName != null) { writer.Write(true); ((ICompactSerializable)_storedProcedureName).Serialize(writer); } else { writer.Write(false); } if (Query != null) { writer.Write(true); ((ICompactSerializable)Query).Serialize(writer); } else { writer.Write(false); } }
void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("ActionId", ActionId.ToString()); writer.WriteAttributeString("Success", Success.ToString()); writer.WriteAttributeString("AffectedRows", AffectedRows.ToString()); writer.WriteAttributeString("RowVersion", RowVersion.ToString()); writer.WriteStartElement("FailureMessage"); if (!string.IsNullOrEmpty(FailureMessage)) { writer.WriteValue(FailureMessage); } writer.WriteEndElement(); writer.WriteStartElement("Result"); if (Result != null) { writer.WriteValue(Result); } writer.WriteEndElement(); writer.WriteStartElement("Parameters", Namespaces.Data); if (Parameters != null) { foreach (System.Xml.Serialization.IXmlSerializable parameter in Parameters) { writer.WriteStartElement("Parameter", Namespaces.Data); if (parameter != null) { parameter.WriteXml(writer); } writer.WriteEndElement(); } } writer.WriteEndElement(); writer.WriteStartElement("AlternativeActions", Namespaces.Data); foreach (System.Xml.Serialization.IXmlSerializable parameter in AlternativeActions) { writer.WriteStartElement("PersistenceActionResult", Namespaces.Data); if (parameter != null) { parameter.WriteXml(writer); } writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("BeforeActions", Namespaces.Data); foreach (System.Xml.Serialization.IXmlSerializable parameter in BeforeActions) { writer.WriteStartElement("PersistenceActionResult", Namespaces.Data); if (parameter != null) { parameter.WriteXml(writer); } writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("AfterActions", Namespaces.Data); foreach (System.Xml.Serialization.IXmlSerializable parameter in AfterActions) { writer.WriteStartElement("PersistenceActionResult", Namespaces.Data); if (parameter != null) { parameter.WriteXml(writer); } writer.WriteEndElement(); } writer.WriteEndElement(); }