Exemplo n.º 1
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 public void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     if (reader.ReadBoolean())
     {
         _term = ConditionalTerm.GetConditionalTerm(reader);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Faz a desserialização do objeto.
 /// </summary>
 /// <param name="reader"></param>
 protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     if (reader.ReadBoolean())
     {
         _term = GetConditionalTerm(reader);
     }
 }
Exemplo n.º 3
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);
            }
 /// <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();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     while (reader.ReadBoolean())
     {
         var union = new UnionInfo();
         ((ICompactSerializable)union).Deserialize(reader);
         _unions.Add(union);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 public void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     _all = reader.ReadBoolean();
     if (reader.ReadBoolean())
     {
         _query = new QueryInfo();
         ((ICompactSerializable)_query).Deserialize(reader);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     while (reader.ReadBoolean())
     {
         var column = new SortEntry();
         ((ICompactSerializable)column).Deserialize(reader);
         _columns.Add(column);
     }
 }
Exemplo n.º 8
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);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// Faz a desserialização do objeto.
 /// </summary>
 /// <param name="reader"></param>
 void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     if (reader.ReadBoolean())
     {
         _expression = ConditionalTerm.GetConditionalTerm(reader);
     }
     if (reader.ReadBoolean())
     {
         _resultExpression = ConditionalTerm.GetConditionalTerm(reader);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Deserializa usando o CompactSerializer.
        /// </summary>
        /// <param name="reader">Representa o compact reader.</param>
        void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            var count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var parameter = new ReferenceParameterValue();
                ((Colosoft.Serialization.ICompactSerializable)parameter).Deserialize(reader);
                Add(parameter);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Deserializa usando o CompactSerializer.
        /// </summary>
        /// <param name="reader">Representa o compact reader.</param>
        public void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            var count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var parameter = new QueryParameter();
                parameter.Deserialize(reader);
                Add(parameter);
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// Desserializa o objeto.
 /// </summary>
 /// <param name="reader"></param>
 void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     if (_columns == null)
     {
         _columns = new List <GroupByEntry>();
     }
     while (reader.ReadBoolean())
     {
         var column = new GroupByEntry();
         ((ICompactSerializable)column).Deserialize(reader);
         _columns.Add(column);
     }
 }
Exemplo n.º 13
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();
 }
Exemplo n.º 14
0
        /// <summary>
        /// Desserializa o objeto.
        /// </summary>
        /// <param name="reader"></param>
        protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            int length = reader.ReadInt32();

            _values = new ConditionalTerm[length];
            for (int i = 0; i < length; i++)
            {
                if (reader.ReadBoolean())
                {
                    _values[i] = GetConditionalTerm(reader);
                }
            }
        }
Exemplo n.º 15
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();
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Recupera os registros serializados no leitor informado.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static IEnumerable <Record> GetRecords(Colosoft.Serialization.IO.CompactReader reader)
        {
            var hasDescriptor = reader.ReadByte() == 1;

            if (hasDescriptor)
            {
                var descriptor = new Record.RecordDescriptor();
                ((Colosoft.Serialization.ICompactSerializable)descriptor).Deserialize(reader);
                while (reader.ReadByte() == 1)
                {
                    var r = new Record(descriptor);
                    ((Colosoft.Serialization.ICompactSerializable)r).Deserialize(reader);
                    yield return(r);
                }
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// Faz a desserialização do objeto.
 /// </summary>
 /// <param name="reader"></param>
 protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     if (reader.ReadBoolean())
     {
         _inputExpression = GetConditionalTerm(reader);
     }
     while (reader.ReadBoolean())
     {
         var caseWhenExpression = new CaseWhenExpression();
         ((Colosoft.Serialization.ICompactSerializable)caseWhenExpression).Deserialize(reader);
         _whenExpressions.Add(caseWhenExpression);
     }
     if (reader.ReadBoolean())
     {
         _elseResultExpression = GetConditionalTerm(reader);
     }
 }
Exemplo n.º 18
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);
            }
        }
Exemplo n.º 19
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);
                }
            }
Exemplo n.º 20
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"))
            {
                _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();
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Deserializa os dados na instancia.
        /// </summary>
        /// <param name="reader"></param>
        public virtual void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            _values = new object[_descriptor.Count];
            var buffer = new byte[1];

            for (var i = 0; i < _descriptor.Count; i++)
            {
                var field  = _descriptor[i];
                var isNull = reader.Read(buffer, 0, 1) == 1 && buffer[0] == (byte)1;
                if (!isNull)
                {
                    try
                    {
                        _values[i] = reader.ReadObject();
                    }
                    catch (Exception ex)
                    {
                        throw new System.Runtime.Serialization.SerializationException(ResourceMessageFormatter.Create(() => Properties.Resources.Record_DeserializeFieldError, field.Name, field.Type.FullName, ex.Message).Format(), ex);
                    }
                }
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Deserializa os dados na instancia.
        /// </summary>
        /// <param name="reader"></param>
        void Colosoft.Serialization.ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
        {
            var hasDescriptor = reader.ReadByte() == 1;

            if (hasDescriptor)
            {
                _descriptor = new Record.RecordDescriptor();
                ((Colosoft.Serialization.ICompactSerializable)_descriptor).Deserialize(reader);
                var records = new List <Record>();
                while (reader.ReadByte() == 1)
                {
                    var r = new Record(_descriptor);
                    ((Colosoft.Serialization.ICompactSerializable)r).Deserialize(reader);
                    records.Add(r);
                }
                _records = records;
            }
            else
            {
                _records = new Record[0];
            }
        }
Exemplo n.º 23
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;
            }
        }
Exemplo n.º 24
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();
        }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
0
 /// <summary>
 /// Faz a desserialização do objeto.
 /// </summary>
 /// <param name="reader"></param>
 protected abstract void Deserialize(Colosoft.Serialization.IO.CompactReader reader);
Exemplo n.º 27
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();
 }
Exemplo n.º 28
0
 void ICompactSerializable.Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     Deserialize(reader);
 }
Exemplo n.º 29
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);
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// Deserializa com o compact serializer.
 /// </summary>
 /// <param name="reader"></param>
 protected override void Deserialize(Colosoft.Serialization.IO.CompactReader reader)
 {
     ((ICompactSerializable)_queryInfo).Deserialize(reader);
 }