Beispiel #1
0
        public object To(Type type, string json)
        {
            if (json == null)
            {
                throw new ArgumentException(Messages.InvalidValue);
            }
            var parseEngine = new ParseEngine();

            var jsonValue = parseEngine.Parse(json);

            return(MapEngine.Map(type, jsonValue));
        }
Beispiel #2
0
        public MapContext()
        {
            Mappers            = new MapperContainer();
            Configuration      = new ConfigContainer();
            Types              = new TypeContainer();
            CollBuilder        = new CollectionBuilder();
            SerializerMapper   = new ConcurrentDictionary <Type, Action <object, StringBuilder> >();
            DeserializerMapper = new ConcurrentDictionary <Type, Func <Type, JValue, object> >();
            DictReflector      = new DictReflector();
            var enumCache = new EnumCache();

            MapEngine = new MapEngine(Types, Mappers, Configuration, CollBuilder, DeserializerMapper, enumCache, DictReflector);
        }