Example #1
0
            void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
            {
                var name         = reader.ReadString();
                var typeFullName = reader.ReadString();

                Name = name;
                Type = Type.GetType(typeFullName, true);
            }
Example #2
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     _left  = reader.ReadString();
     _right = reader.ReadString();
     _type  = (JoinType)Enum.Parse(typeof(JoinType), reader.ReadString());
     if (reader.ReadBoolean())
     {
         _conditional = new ConditionalContainer();
         ((ICompactSerializable)_conditional).Deserialize(reader);
     }
 }
Example #3
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     if (reader.ReadBoolean())
     {
         _fullName = reader.ReadString();
     }
     if (reader.ReadBoolean())
     {
         _subQuery = new QueryInfo();
         ((ICompactSerializable)_subQuery).Deserialize(reader);
     }
     _alias = reader.ReadString();
 }
Example #4
0
        /// <summary>
        /// Faz a desserialização do objeto.
        /// </summary>
        /// <param name="reader"></param>
        protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            string position = reader.ReadString();

            while (position.Equals("ConditionalTerm"))
            {
                _parts.Add(GetConditionalTerm(reader));
                position = reader.ReadString();
            }
            while (position.Equals("Operator"))
            {
                _operators.Add((MathematicalOperator)Enum.Parse(typeof(MathematicalOperator), reader.ReadString()));
                position = reader.ReadString();
            }
        }
 /// <summary>
 /// Deserializa usando o CompactSerializer.
 /// </summary>
 /// <param name="reader">Representa o compact reader.</param>
 void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     _columnName = reader.ReadString();
     if (reader.ReadByte() == 1)
     {
         _value = reader.ReadObject();
     }
 }
Example #6
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 public void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     _alias = reader.ReadString();
     if (reader.ReadBoolean())
     {
         _term = ConditionalTerm.GetConditionalTerm(reader);
     }
 }
Example #7
0
            /// <summary>
            /// Deserializa os dados para a instancia.
            /// </summary>
            /// <param name="reader"></param>
            void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
            {
                Name = reader.ReadString();
                var locale = reader.ReadString();

                if (!string.IsNullOrEmpty(locale))
                {
                    _locale = System.Globalization.CultureInfo.GetCultureInfo(locale);
                }
                var count = reader.ReadInt32();

                _fields = new List <Field>(count);
                for (var i = 0; i < count; i++)
                {
                    var field = new Field();
                    ((Colosoft.Serialization.ICompactSerializable)field).Deserialize(reader);
                    _fields.Add(field);
                }
            }
Example #8
0
        /// <summary>
        /// Faz a desserialização do objeto.
        /// </summary>
        /// <param name="reader"></param>
        protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            string position = reader.ReadString();

            if (position == "Left")
            {
                _left = GetConditionalTerm(reader);
            }
            position = reader.ReadString();
            if (position == "Operator")
            {
                _operator = (Operator)GetConditionalTerm(reader);
            }
            position = reader.ReadString();
            if (position == "Right")
            {
                _right = GetConditionalTerm(reader);
            }
        }
        /// <summary>
        /// Faz a desserialização do objeto.
        /// </summary>
        /// <param name="reader"></param>
        protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            string position = reader.ReadString();

            while (position.Equals("ConditionalTerm"))
            {
                _conditionals.Add(GetConditionalTerm(reader));
                position = reader.ReadString();
            }
            while (position.Equals("LogicalOperator"))
            {
                _logicalOperators.Add((LogicalOperator)Enum.Parse(typeof(LogicalOperator), reader.ReadString()));
                position = reader.ReadString();
            }
            while (position.Equals("Parameter"))
            {
                var parameter = new QueryParameter();
                ((ICompactSerializable)parameter).Deserialize(reader);
                Add(parameter);
                position = reader.ReadString();
            }
        }
Example #10
0
        /// <summary>
        /// Deserializa usando o CompactSerializer.
        /// </summary>
        /// <param name="reader">Representa o compact reader.</param>
        public void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            _name      = reader.ReadString();
            _direction = (ParameterDirection)reader.ReadInt32();
            var option = reader.ReadByte();

            if (option == 1)
            {
                _value = reader.ReadObject();
            }
            else if (option == 2)
            {
                var refParameter = new ReferenceParameter();
                ((Colosoft.Serialization.ICompactSerializable)refParameter).Deserialize(reader);
                _value = refParameter;
            }
            else if (option == 3)
            {
                var queryInfo = new QueryInfo();
                ((Colosoft.Serialization.ICompactSerializable)queryInfo).Deserialize(reader);
                _value = queryInfo;
            }
        }
Example #11
0
        void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            this.Expression = reader.ReadString();
            var count      = reader.ReadInt32();
            var parameters = new List <QueryParameter>(count);

            for (var i = 0; i < count; i++)
            {
                var parameter = new QueryParameter();
                ((Colosoft.Serialization.ICompactSerializable)parameter).Deserialize(reader);
                parameters.Add(parameter);
            }
            _parameters = parameters.ToArray();
            count       = reader.ReadInt32();
            var requiredFields = new List <RequiredField>(count);

            for (var i = 0; i < count; i++)
            {
                var field = new RequiredField();
                ((Colosoft.Serialization.ICompactSerializable)field).Deserialize(reader);
                requiredFields.Add(field);
            }
            _requiredFields = requiredFields.ToArray();
        }
Example #12
0
 /// <summary>
 /// Faz a desserialização do objeto.
 /// </summary>
 /// <param name="reader"></param>
 protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     Op = reader.ReadString();
 }
Example #13
0
        /// <summary>
        /// Desserializa o objeto.
        /// </summary>
        /// <param name="reader"></param>
        void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            _id = reader.ReadInt32();
            _isSelectDistinct       = reader.ReadBoolean();
            _ignoreRegisterUserInfo = reader.ReadBoolean();
            try
            {
                Enum.TryParse <QueryMethod>(reader.ReadString(), out _method);
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
            _isolationLevel   = (System.Transactions.IsolationLevel)reader.ReadInt16();
            _commandTimeout   = reader.ReadInt32();
            _providerName     = reader.ReadString();
            _ignoreTypeSchema = reader.ReadBoolean();
            if (reader.ReadBoolean())
            {
                _storedProcedureProvider = reader.ReadString();
            }
            if (reader.ReadBoolean())
            {
                _projection = new Projection();
                ((ICompactSerializable)_projection).Deserialize(reader);
            }
            if (reader.ReadBoolean())
            {
                _executePredicate = new QueryExecutePredicate();
                ((ICompactSerializable)_executePredicate).Deserialize(reader);
            }
            var entitiesQueue = new Queue <EntityInfo>();

            while (reader.ReadBoolean())
            {
                var entity = new EntityInfo();
                ((ICompactSerializable)entity).Deserialize(reader);
                entitiesQueue.Enqueue(entity);
            }
            _entities = entitiesQueue.ToArray();
            var joinQueue = new Queue <JoinInfo>();

            while (reader.ReadBoolean())
            {
                var join = new JoinInfo();
                ((ICompactSerializable)join).Deserialize(reader);
                joinQueue.Enqueue(join);
            }
            _joins = joinQueue.ToArray();
            if (reader.ReadBoolean())
            {
                _whereClause = new ConditionalContainer();
                ((ICompactSerializable)_whereClause).Deserialize(reader);
            }
            if (reader.ReadBoolean())
            {
                _sort = new Sort();
                ((ICompactSerializable)_sort).Deserialize(reader);
            }
            if (reader.ReadBoolean())
            {
                _groupby = new GroupBy();
                ((ICompactSerializable)_groupby).Deserialize(reader);
            }
            if (reader.ReadBoolean())
            {
                _having = new ConditionalContainer();
                ((ICompactSerializable)_having).Deserialize(reader);
            }
            if (reader.ReadBoolean())
            {
                _takeParameters = new TakeParameters();
                ((ICompactSerializable)_takeParameters).Deserialize(reader);
            }
            var nestedQueries = new List <QueryInfo>();

            while (reader.ReadBoolean())
            {
                var nestedQuery = new QueryInfo();
                ((ICompactSerializable)nestedQuery).Deserialize(reader);
                nestedQueries.Add(nestedQuery);
            }
            _nestedQueries = nestedQueries.ToArray();
            if (_parameters == null)
            {
                _parameters = new QueryParameterCollection();
            }
            while (reader.ReadBoolean())
            {
                var parameter = new QueryParameter();
                parameter.Deserialize(reader);
                _parameters.Add(parameter);
            }
            if (reader.ReadBoolean())
            {
                _storedProcedureName = new StoredProcedureName();
                ((ICompactSerializable)_storedProcedureName).Deserialize(reader);
            }
            if (_unions == null)
            {
                _unions = new UnionInfoCollection();
            }
            while (reader.ReadBoolean())
            {
                var union = new UnionInfo();
                union.Deserialize(reader);
                _unions.Add(union);
            }
        }
Example #14
0
        /// <summary>
        /// Recupera o termo condicional contido no reader.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        internal static protected ConditionalTerm GetConditionalTerm(Colosoft.Serialization.IO.CompactReader reader)
        {
            var             type = reader.ReadString();
            ConditionalTerm term = null;

            if (string.IsNullOrEmpty(type))
            {
                term = new Constant();
            }
            else
            {
                if (type == "Conditional")
                {
                    term = new Conditional();
                }
                else if (type == "ConditionalContainer")
                {
                    term = new ConditionalContainer();
                }
                else if (type == "Operator")
                {
                    term = new Operator();
                }
                else if (type == "Constant")
                {
                    term = new Constant();
                }
                else if (type == "Column")
                {
                    term = new Column();
                }
                else if (type == "Variable")
                {
                    term = new Variable();
                }
                else if (type == "ValuesArray")
                {
                    term = new ValuesArray();
                }
                else if (type == "QueryTerm")
                {
                    term = new QueryTerm();
                }
                else if (type == "FunctionCall")
                {
                    term = new FunctionCall();
                }
                else if (type == "MinusTerm")
                {
                    term = new MinusTerm();
                }
                else if (type == "Formula")
                {
                    term = new Formula();
                }
                else if (type == "Empty")
                {
                    return(null);
                }
                else
                {
                    throw new QueryInvalidOperationException("Invalid conditional type");
                }
            }
            ((ICompactSerializable)term).Deserialize(reader);
            return(term);
        }
 void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     _name   = reader.ReadString();
     _schema = reader.ReadString();
 }
 /// <summary>
 /// Deserializa os dados.
 /// </summary>
 /// <param name="reader"></param>
 void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     this.ColumnName = reader.ReadString();
 }
Example #17
0
 void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     _name  = reader.ReadString();
     _index = reader.ReadInt32();
 }