Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net core 如何编写通过前缀访问所有字段的ModelBinder?_Asp.net Core_Model Binding_Custom Model Binder - Fatal编程技术网

Asp.net core 如何编写通过前缀访问所有字段的ModelBinder?

Asp.net core 如何编写通过前缀访问所有字段的ModelBinder?,asp.net-core,model-binding,custom-model-binder,Asp.net Core,Model Binding,Custom Model Binder,例如,我喜欢我的ModelBinder将所有“field_???”值转换为我的单个自定义对象。 我怎么能做到? ValueProvider.GetValue只允许我使用确切的名称进行访问,并且我无法枚举所有可能的字段…请尝试以下操作: public IActionResult OnPost([Bind(Prefix = "field_")] Whatever model) 读这篇文章

例如,我喜欢我的ModelBinder将所有“field_???”值转换为我的单个自定义对象。 我怎么能做到? ValueProvider.GetValue只允许我使用确切的名称进行访问,并且我无法枚举所有可能的字段…

请尝试以下操作:

public IActionResult OnPost([Bind(Prefix = "field_")] Whatever model)
读这篇文章