0
私はそうのように見えるウェブアピモデルバインダーを持っています。 NameValueCollectionのが唯一の方法は、MVCに存在し テストウェブアピモデルバインダーは
public TModel BindModel<TBinder, TModel>(NameValueCollection formCollection, TBinder binder)
where TBinder : IModelBinder
{
var valueProvider = new NameValueCollectionValueProvider(formCollection, null);
var dataProvider = new DataAnnotationsModelMetadataProvider();
var modelMetadata = dataProvider.GetMetadataForType(null, typeof(TModel));
var bindingContext = new ModelBindingContext
{
ModelName = typeof(TModel).Name,
ValueProvider = valueProvider,
ModelMetadata = modelMetadata
};
binder.BindModel(null, bindingContext);
return (TModel)bindingContext.ModelMetadata.Model;
}
を
しかしWEBAPIを使用するように変換しようとしたとき、私は値プロバイダーを移入する方法を見つけ出すことはできません。私がMVCのモデルバインダーhereで動作する機能を見つけました