// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace Microsoft.AspNetCore.Mvc { /// /// Options used to configure behavior for types annotated with . /// public class ApiBehaviorOptions { private Func _invalidModelStateResponseFactory; /// /// Delegate invoked on actions annotated with to convert invalid /// into an /// /// By default, the delegate produces a that wraps a serialized form /// of . /// /// public Func InvalidModelStateResponseFactory { get => _invalidModelStateResponseFactory; set => _invalidModelStateResponseFactory = value ?? throw new ArgumentNullException(nameof(value)); } /// /// Gets or sets a value that determines if the filter that returns an when /// is invalid is suppressed. . /// public bool SuppressModelStateInvalidFilter { get; set; } /// /// Gets or sets a value that determines if model binding sources are inferred for action parameters on controllers annotated /// with is suppressed. /// /// When enabled, the following sources are inferred: /// Parameters that appear as route values, are assumed to be bound from the path (). /// Parameters of type and are assumed to be bound from form. /// Parameters that are complex () are assumed to be bound from the body (). /// All other parameters are assumed to be bound from the query. /// /// public bool SuppressInferBindingSourcesForParameters { get; set; } /// /// Gets or sets a value that determines if an multipart/form-data consumes action constraint is added to parameters /// that are bound from form data. /// public bool SuppressConsumesConstraintForFormFileParameters { get; set; } } }