public object InitializeFromDictionary(Type objectType, IDictionary<string, object> values)
        {
            ValueProvider dictionaryProvider = new DictionaryValueProvider(values);

            ModelBinder binder = new FastModelBinder();
            ModelBinderContext context = new InitializerModelBinderContext(dictionaryProvider);

            object obj = binder.Bind(objectType, context);

            return obj;
        }
示例#2
0
        public object InitializeFromDictionary(Type objectType, IDictionary <string, object> values)
        {
            ValueProvider dictionaryProvider = new DictionaryValueProvider(values);

            ModelBinder        binder  = new FastModelBinder();
            ModelBinderContext context = new InitializerModelBinderContext(dictionaryProvider);

            object obj = binder.Bind(objectType, context);

            return(obj);
        }