标签:style http color 使用 os io 数据 for
每次http请求的各种数据(表单数据、url的数据、路由数据等等)都保存在不同的IValueProvider接口的实现类中。
而IValueProvider接口的实现类是通过ValueProviderFactory创建的。
在mvc中原生的ValueProviderFactory有六种:
ValueProviderFactory需要注册到ValueProviderFactories的静态属性Factories中,才能被使用。
1: public static class ValueProviderFactories
2: {
3: public static ValueProviderFactoryCollection Factories { get; }
4: }
6: public class ValueProviderFactoryCollection : Collection<ValueProviderFactory>
7: {
8: public ValueProviderFactoryCollection();
9: public ValueProviderFactoryCollection(IList<ValueProviderFactory> list);
10: public IValueProvider GetValueProvider(ControllerContext controllerContext);
11: }
系统首先通过ValueProviderFactories类的静态属性获得ValueProviderFactoryCollection ,然后通过GetValueProvider方法获得一个ValueProviderCollection,ValueProviderCollection就是值提供器集合。
1: public class ValueProviderCollection : Collection<IValueProvider>, IUnvalidatedValueProvider, IEnumerableValueProvider, IValueProvider
2: {
3: public ValueProviderCollection();
4: public ValueProviderCollection(IList<IValueProvider> list);
6: public virtual bool ContainsPrefix(string prefix);
7: public virtual IDictionary<string, string> GetKeysFromPrefix(string prefix);
8: public virtual ValueProviderResult GetValue(string key);
9: public virtual ValueProviderResult GetValue(string key, bool skipValidation);
10: }
mvc action 参数绑定——值提供器【学习笔记】,布布扣,bubuko.com
标签:style http color 使用 os io 数据 for
原文地址:http://www.cnblogs.com/lxiang/p/3919025.html