ApiBehaviorOptions.SuppressInferBindingSourcesForParameters 属性

定义

获取或设置一个值,该值确定是否对使用 ApiControllerAttribute 批注的控制器上的操作参数推断模型绑定源。

启用后,将推断以下源:显示为路由值的参数假定从路径绑定 (Path) 。 假定类型为 和 IFormFileCollection 的参数IFormFile从窗体绑定。 如果参数复杂 (IsComplexType) 并在 DI 容器 (IServiceCollection) 中注册,则假定从服务 Services绑定,除非显式禁用 DisableImplicitFromServicesParameters此选项。 假定复杂 (IsComplexType) 的参数从正文 (Body) 绑定。 假定所有其他参数都与查询绑定。

public:
 property bool SuppressInferBindingSourcesForParameters { bool get(); void set(bool value); };
public bool SuppressInferBindingSourcesForParameters { get; set; }
member this.SuppressInferBindingSourcesForParameters : bool with get, set
Public Property SuppressInferBindingSourcesForParameters As Boolean

属性值

适用于