示例#1
0
        public T Read(string mimeType)
        {
            var model = _formatter.Read <T>();

            _objectResolver.BindProperties(model, _bindingContext);
            return(model);
        }
示例#2
0
        public void Read <T>(T target, string input)
        {
            var settings = _blocks.SettingsFor(typeof(T));
            var block    = _parser.Parse(input, settings);
            var data     = new RequestData(new ObjectBlockValues(block, settings, typeof(T)));
            var context  = new BindingContext(data, _services, new NulloBindingLogger());

            _resolver.BindProperties(target, context);
        }
        public T Read <T>()
        {
            var    serializer = new JavaScriptSerializer();
            string inputText  = _data.InputText();
            var    model      = serializer.Deserialize <T>(inputText);

            _objectResolver.BindProperties(model, new BindingContext(_requestData, _serviceLocator, new NulloBindingLogger()));
            return(model);
        }
        private void readTargetFromLine(FlatFileRequest <T> request, FlatFileValues data, string line, BindingContext context)
        {
            data.ReadLine(line);

            var target = request.Finder(new RequestData(new FlatValueSource(data)));

            _resolver.BindProperties(target, context);

            request.Callback(target);
        }
示例#5
0
        public void Build <T>(RowProcessingRequest <T> input)
        {
            IDataReader reader = input.Reader;

            // TODO -- awkward!  Let's do some convenience methods here and make this easier
            var request = new DataReaderValues(reader, _aliases);
            var context = new BindingContext(new RequestData(new FlatValueSource(request)), _services, new NulloBindingLogger());

            while (reader.Read())
            {
                T target = input.Finder(reader);
                _binder.BindProperties(target, context);

                input.Callback(target);
            }
        }