Class UmbracoApiBehaviorApplicationModelProvider
An application model provider for Umbraco API controllers to behave like WebApi controllers
Inheritance
Namespace: Umbraco.Cms.Web.Common.ApplicationModels
Assembly: Umbraco.Web.Common.dll
Syntax
public class UmbracoApiBehaviorApplicationModelProvider : IApplicationModelProvider
Remarks
Conventions will be applied to controllers attributed with UmbracoApiControllerAttribute
This is nearly a copy of aspnetcore's ApiBehaviorApplicationModelProvider which supplies a convention for the [ApiController] attribute, however that convention is too strict for our purposes so we will have our own. Uses UmbracoJsonModelBinder for complex parameters and those with BindingSource of Body, but leaves the rest alone see GH #11554
See https://shazwazza.com/post/custom-body-model-binding-per-controller-in-asp-net-core/ and https://github.com/dotnet/aspnetcore/issues/21724
Constructors
View SourceUmbracoApiBehaviorApplicationModelProvider(IModelMetadataProvider)
Initializes a new instance of the UmbracoApiBehaviorApplicationModelProvider class.
Declaration
public UmbracoApiBehaviorApplicationModelProvider(IModelMetadataProvider modelMetadataProvider)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider | modelMetadataProvider |
Properties
View SourceOrder
Will execute after Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider
Declaration
public int Order { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
View SourceOnProvidersExecuted(ApplicationModelProviderContext)
Declaration
public void OnProvidersExecuted(ApplicationModelProviderContext context)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelProviderContext | context |
OnProvidersExecuting(ApplicationModelProviderContext)
Declaration
public void OnProvidersExecuting(ApplicationModelProviderContext context)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelProviderContext | context |