Пример #1
0
        public static ColumnInfo Deserialize(BinaryReader reader, ITypeResolver typeResolver)
        {
            var version = reader.ReadInt32();

            if (version != 3)
            {
                throw new FormatException("Invalid version of the Column-Info");
            }

            var columnName = reader.ReadString();
            var columnType = TypeSerializer.Deserialize(reader, typeResolver);

            var notNull = reader.ReadByte() == 1;

            var columnInfo = new ColumnInfo(columnName, columnType);

            columnInfo.IsNotNull = notNull;

            var hasDefault = reader.ReadByte() == 1;

            if (hasDefault)
            {
                columnInfo.DefaultExpression = SqlExpression.Deserialize(reader);
            }

            return(columnInfo);
        }
Пример #2
0
            public override SimplePatternSelectNode Deserialize(BinaryReader reader)
            {
                var child      = ReadChildNode(reader);
                var expression = SqlExpression.Deserialize(reader);

                return(new SimplePatternSelectNode(child, expression));
            }
Пример #3
0
            public override ExhaustiveSelectNode Deserialize(BinaryReader reader)
            {
                var child      = ReadChildNode(reader);
                var expression = SqlExpression.Deserialize(reader);

                return(new ExhaustiveSelectNode(child, expression));
            }
Пример #4
0
            public override SimpleSelectNode Deserialize(BinaryReader reader)
            {
                var child      = ReadChildNode(reader);
                var columnName = ObjectName.Deserialize(reader);
                var opType     = (SqlExpressionType)reader.ReadByte();
                var expression = SqlExpression.Deserialize(reader);

                return(new SimpleSelectNode(child, columnName, opType, expression));
            }
Пример #5
0
            public override JoinNode Deserialize(BinaryReader reader)
            {
                var left  = ReadChildNode(reader);
                var right = ReadChildNode(reader);

                var leftColumnName  = ObjectName.Deserialize(reader);
                var op              = (SqlExpressionType)reader.ReadByte();
                var rightExpression = SqlExpression.Deserialize(reader);

                return(new JoinNode(left, right, leftColumnName, op, rightExpression));
            }
Пример #6
0
 private static SqlExpression[] ReadExpressions(BinaryReader reader)
 {
     return(ReadArray(reader, binaryReader => SqlExpression.Deserialize(reader)));
 }