public override IModelBinder GetBinder(HttpConfiguration configuration, Type modelType)
 {
     return(CollectionModelBinderUtil.GetGenericBinder(
                typeof(IDictionary <,>),
                typeof(Dictionary <,>),
                typeof(DictionaryModelBinder <,>),
                modelType
                ));
 }
示例#2
0
 public override IModelBinder GetBinder(HttpConfiguration configuration, Type modelType)
 {
     return(CollectionModelBinderUtil.GetGenericBinder(
                typeof(ICollection <>),
                typeof(List <>),
                typeof(CollectionModelBinder <>),
                modelType
                ));
 }
示例#3
0
        public override IModelBinder GetBinder(HttpActionContext actionContext, ModelBindingContext bindingContext)
        {
            ModelBindingHelper.ValidateBindingContext(bindingContext);

            if (bindingContext.ValueProvider.ContainsPrefix(bindingContext.ModelName))
            {
                return(CollectionModelBinderUtil.GetGenericBinder(typeof(ICollection <>), typeof(List <>), typeof(CollectionModelBinder <>), bindingContext.ModelMetadata));
            }
            else
            {
                return(null);
            }
        }