Пример #1
0
        /// <summary>
        /// Desserializa o objeto.
        /// </summary>
        /// <param name="reader"></param>
        public void Deserialize(Serialization.IO.CompactReader reader)
        {
            _expression = reader.ReadString();
            var parameters = new List <PersistenceParameter>();
            var count      = reader.ReadInt32();

            for (var i = 0; i < count; i++)
            {
                var parameter = new PersistenceParameter();
                ((ICompactSerializable)parameter).Deserialize(reader);
                parameters.Add(parameter);
            }
            _parameters = new PersistenceParameterCollection(parameters);
        }
Пример #2
0
        /// <summary>
        /// Desserializa o objeto.
        /// </summary>
        /// <param name="reader"></param>
        public void Deserialize(Serialization.IO.CompactReader reader)
        {
            ActionId       = reader.ReadInt32();
            Success        = reader.ReadBoolean();
            AffectedRows   = reader.ReadInt32();
            RowVersion     = reader.ReadInt64();
            FailureMessage = reader.ReadString();
            if (reader.ReadBoolean())
            {
                Result = reader.ReadObject();
            }
            var parameters = new List <PersistenceParameter>();

            while (reader.ReadBoolean())
            {
                PersistenceParameter parameter = new PersistenceParameter();
                ((ICompactSerializable)parameter).Deserialize(reader);
                parameters.Add(parameter);
            }
            Parameters = parameters.ToArray();
            var actions = new List <PersistenceActionResult>();

            while (reader.ReadBoolean())
            {
                PersistenceActionResult action = new PersistenceActionResult();
                ((ICompactSerializable)action).Deserialize(reader);
                actions.Add(action);
            }
            AlternativeActions = actions.ToArray();
            var beforeActions = new List <PersistenceActionResult>();

            while (reader.ReadBoolean())
            {
                PersistenceActionResult action = new PersistenceActionResult();
                ((ICompactSerializable)action).Deserialize(reader);
                beforeActions.Add(action);
            }
            BeforeActions = beforeActions.ToArray();
            var afterActions = new List <PersistenceActionResult>();

            while (reader.ReadBoolean())
            {
                PersistenceActionResult action = new PersistenceActionResult();
                ((ICompactSerializable)action).Deserialize(reader);
                afterActions.Add(action);
            }
            AfterActions = afterActions.ToArray();
        }
Пример #3
0
 /// <summary>
 /// Lê os dados do XML.
 /// </summary>
 /// <param name="reader"></param>
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToElement();
     reader.ReadStartElement();
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("Parameters", Namespaces.Data);
         var parameters = new List <PersistenceParameter>();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "Parameter")
             {
                 var parameter = new PersistenceParameter();
                 ((System.Xml.Serialization.IXmlSerializable)parameter).ReadXml(reader);
                 parameters.Add(parameter);
             }
             else
             {
                 reader.Skip();
             }
         }
         _parameters = new PersistenceParameterCollection(parameters);
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("Expression");
         _expression = reader.ReadElementContentAs(typeof(string), null) as string;
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
     reader.ReadEndElement();
 }
Пример #4
0
        /// <summary>
        /// Desserializa o objeto.
        /// </summary>
        /// <param name="reader"></param>
        public void Deserialize(Serialization.IO.CompactReader reader)
        {
            ActionId       = reader.ReadInt32();
            Type           = (PersistenceActionType)reader.ReadInt32();
            EntityFullName = reader.ReadString();
            ProviderName   = reader.ReadString();
            var RowVersionString = reader.ReadString();

            if (!string.IsNullOrEmpty(RowVersionString))
            {
                RowVersion = long.Parse(RowVersionString);
            }
            else
            {
                RowVersion = null;
            }
            var parameters = new List <PersistenceParameter>();
            var count      = reader.ReadInt32();

            for (var i = 0; i < count; i++)
            {
                var parameter = new PersistenceParameter();
                ((ICompactSerializable)parameter).Deserialize(reader);
                parameters.Add(parameter);
            }
            Parameters = new PersistenceParameterCollection(parameters);
            if (reader.ReadBoolean())
            {
                var conditional = new Colosoft.Query.ConditionalContainer();
                ((ICompactSerializable)conditional).Deserialize(reader);
                this.Conditional = conditional;
            }
            var actions = new List <PersistenceAction>();

            count = reader.ReadInt32();
            for (var i = 0; i < count; i++)
            {
                var persistenceAction = new PersistenceAction();
                ((ICompactSerializable)persistenceAction).Deserialize(reader);
                actions.Add(persistenceAction);
            }
            AlternativeActions.AddRange(actions);
            var beforeActions = new List <PersistenceAction>();

            count = reader.ReadInt32();
            for (var i = 0; i < count; i++)
            {
                var persistenceAction = new PersistenceAction();
                ((ICompactSerializable)persistenceAction).Deserialize(reader);
                beforeActions.Add(persistenceAction);
            }
            BeforeActions.AddRange(beforeActions);
            var afterActions = new List <PersistenceAction>();

            count = reader.ReadInt32();
            for (var i = 0; i < count; i++)
            {
                var persistenceAction = new PersistenceAction();
                ((ICompactSerializable)persistenceAction).Deserialize(reader);
                afterActions.Add(persistenceAction);
            }
            AfterActions.AddRange(afterActions);
            if (reader.ReadBoolean())
            {
                _storedProcedureName = new Colosoft.Query.StoredProcedureName();
                ((ICompactSerializable)_storedProcedureName).Deserialize(reader);
            }
            if (reader.ReadBoolean())
            {
                var query = new Colosoft.Query.QueryInfo();
                ((ICompactSerializable)query).Deserialize(reader);
                this.Query = query;
            }
        }
Пример #5
0
        /// <summary>
        /// Lê os dados do XML.
        /// </summary>
        /// <param name="reader"></param>
        void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
        {
            reader.MoveToAttribute("ActionId");
            ActionId = reader.ReadContentAsInt();
            reader.MoveToAttribute("Type");
            var typeString = reader.ReadContentAsString();

            Type = (PersistenceActionType)Enum.Parse(typeof(PersistenceActionType), typeString);
            reader.MoveToAttribute("EntityFullName");
            EntityFullName = reader.ReadContentAsString();
            reader.MoveToAttribute("ProviderName");
            ProviderName = reader.ReadContentAsString();
            reader.MoveToAttribute("RowVersion");
            var RowVersionString = reader.ReadContentAsString();

            if (!string.IsNullOrEmpty(RowVersionString))
            {
                RowVersion = long.Parse(RowVersionString);
            }
            else
            {
                RowVersion = null;
            }
            if (reader.MoveToAttribute("CommandTimeout"))
            {
                var timeout = 0;
                if (int.TryParse(reader.ReadContentAsString(), out timeout))
                {
                    CommandTimeout = timeout;
                }
            }
            reader.MoveToElement();
            reader.ReadStartElement();
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("Parameters", Namespaces.Data);
                var parameters = new List <PersistenceParameter>();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.LocalName == "Parameter")
                    {
                        var parameter = new PersistenceParameter();
                        ((System.Xml.Serialization.IXmlSerializable)parameter).ReadXml(reader);
                        parameters.Add(parameter);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                Parameters = new PersistenceParameterCollection(parameters);
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }
            if (!reader.IsEmptyElement)
            {
                var conditional = new Colosoft.Query.ConditionalContainer();
                ((System.Xml.Serialization.IXmlSerializable)conditional).ReadXml(reader);
                this.Conditional = conditional;
            }
            else
            {
                reader.Skip();
            }
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("AlternativeActions");
                var actions = new List <PersistenceAction>();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.LocalName == "PersistenceAction")
                    {
                        var persistenceAction = new PersistenceAction();
                        ((System.Xml.Serialization.IXmlSerializable)persistenceAction).ReadXml(reader);
                        actions.Add(persistenceAction);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                AlternativeActions.AddRange(actions);
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("BeforeActions");
                var actions = new List <PersistenceAction>();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.LocalName == "PersistenceAction")
                    {
                        var persistenceAction = new PersistenceAction();
                        ((System.Xml.Serialization.IXmlSerializable)persistenceAction).ReadXml(reader);
                        actions.Add(persistenceAction);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                BeforeActions.AddRange(actions);
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }
            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement("AfterActions");
                var actions = new List <PersistenceAction>();
                while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.LocalName == "PersistenceAction")
                    {
                        var persistenceAction = new PersistenceAction();
                        ((System.Xml.Serialization.IXmlSerializable)persistenceAction).ReadXml(reader);
                        actions.Add(persistenceAction);
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                AfterActions.AddRange(actions);
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }
            _storedProcedureName = ReadItem <Colosoft.Query.StoredProcedureName>(reader, "StoredProcedureName");
            if (!reader.IsEmptyElement)
            {
                var query = new Colosoft.Query.QueryInfo();
                ((System.Xml.Serialization.IXmlSerializable)query).ReadXml(reader);
                this.Query = query;
            }
            else
            {
                reader.Skip();
            }
            reader.ReadEndElement();
        }
Пример #6
0
 void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
 {
     reader.MoveToAttribute("ActionId");
     ActionId = reader.ReadContentAsInt();
     reader.MoveToAttribute("Success");
     Success = bool.Parse(reader.ReadContentAsString());
     reader.MoveToAttribute("AffectedRows");
     AffectedRows = reader.ReadContentAsInt();
     reader.MoveToAttribute("RowVersion");
     RowVersion = reader.ReadContentAsLong();
     reader.MoveToElement();
     reader.ReadStartElement();
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("FailureMessage");
         FailureMessage = reader.ReadString();
         reader.ReadEndElement();
     }
     else
     {
         FailureMessage = null;
         reader.Skip();
     }
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("Result");
         Result = reader.ReadContentAsObject();
         reader.ReadEndElement();
     }
     else
     {
         Result = null;
         reader.Skip();
     }
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("Parameters", Namespaces.Data);
         var parameters = new List <PersistenceParameter>();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "Parameter")
             {
                 var parameter = new PersistenceParameter();
                 ((System.Xml.Serialization.IXmlSerializable)parameter).ReadXml(reader);
                 parameters.Add(parameter);
             }
             else
             {
                 reader.Skip();
             }
         }
         Parameters = parameters.ToArray();
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("AlternativeActions", Namespaces.Data);
         var actions = new List <PersistenceActionResult>();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "PersistenceActionResult")
             {
                 var action = new PersistenceActionResult();
                 ((System.Xml.Serialization.IXmlSerializable)action).ReadXml(reader);
                 actions.Add(action);
             }
             else
             {
                 reader.Skip();
             }
         }
         AlternativeActions = actions.ToArray();
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("BeforeActions", Namespaces.Data);
         var actions = new List <PersistenceActionResult>();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "PersistenceActionResult")
             {
                 var action = new PersistenceActionResult();
                 ((System.Xml.Serialization.IXmlSerializable)action).ReadXml(reader);
                 actions.Add(action);
             }
             else
             {
                 reader.Skip();
             }
         }
         BeforeActions = actions.ToArray();
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("AfterActions", Namespaces.Data);
         var actions = new List <PersistenceActionResult>();
         while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
         {
             if (reader.LocalName == "PersistenceActionResult")
             {
                 var action = new PersistenceActionResult();
                 ((System.Xml.Serialization.IXmlSerializable)action).ReadXml(reader);
                 actions.Add(action);
             }
             else
             {
                 reader.Skip();
             }
         }
         AfterActions = actions.ToArray();
         reader.ReadEndElement();
     }
     else
     {
         reader.Skip();
     }
     reader.ReadEndElement();
 }