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