예제 #1
0
        public QueryStringSchema(Encoding encoding)
        {
            var decoderConverter = new DecoderConverter();

            this.decoderConverter  = decoderConverter;
            this.decoderDescriptor =
                new TreeDecoderDescriptor <ReaderState, string, char, TEntity>(decoderConverter,
                                                                               new ReaderDefinition <TEntity>());
            this.encoding = encoding;
        }
예제 #2
0
        /// <summary>
        /// Create new JSON schema using given settings
        /// </summary>
        /// <param name="configuration">Text encoding, ignore null...</param>
        public JSONSchema(JSONConfiguration configuration)
        {
            var writerDefinition = new WriterDefinition <TEntity>();
            var readerDefinition = new ReaderDefinition <TEntity>();

            this.configuration     = configuration;
            this.decoderConverter  = new DecoderConverter();
            this.encoderConverter  = new EncoderConverter();
            this.decoderDescriptor = new TreeDecoderDescriptor <ReaderState, JSONValue, int, TEntity>(this.decoderConverter, readerDefinition);
            this.encoderDescriptor = new TreeEncoderDescriptor <WriterState, JSONValue, TEntity>(this.encoderConverter, writerDefinition);
        }
예제 #3
0
        public ProtobufSchema(TextReader proto, string messageName, ProtobufConfiguration configuration)
        {
            var bindings         = Parser.Parse(proto).Resolve(messageName);
            var decoderConverter = new DecoderConverter();
            var encoderConverter = new EncoderConverter();
            var reader           = new ProtobufReaderDefinition <TEntity>(bindings, configuration.RejectUnknown);
            var writer           = new ProtobufWriterDefinition <TEntity>(bindings);

            this.decoderConverter  = decoderConverter;
            this.decoderDescriptor =
                new TreeDecoderDescriptor <ReaderState, ProtobufValue, int, TEntity>(decoderConverter, reader);

            this.encoderConverter  = encoderConverter;
            this.encoderDescriptor =
                new TreeEncoderDescriptor <WriterState, ProtobufValue, TEntity>(encoderConverter, writer);
        }
예제 #4
0
        public RawProtobufSchema(RawProtobufConfiguration configuration)
        {
            var decoderConverter = new RawProtobufDecoderConverter();
            var encoderConverter = new RawProtobufEncoderConverter();
            var readerDefinition = new ReaderDefinition <TEntity>();
            var writerDefinition = new WriterDefinition <TEntity>();

            this.configuration     = configuration;
            this.decoderConverter  = decoderConverter;
            this.decoderDescriptor =
                new TreeDecoderDescriptor <ReaderState, RawProtobufValue, char, TEntity>(decoderConverter,
                                                                                         readerDefinition);
            this.encoderConverter  = encoderConverter;
            this.encoderDescriptor =
                new TreeEncoderDescriptor <WriterState, RawProtobufValue, TEntity>(encoderConverter,
                                                                                   writerDefinition);
        }