HttpActionContextExtensions.TryBindStrongModel<TModel> Method
Binds the model to the property by using the specified execution context and binding context.
Namespace: System.Web.Http.Controllers
Assembly: System.Web.Http (in System.Web.Http.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function TryBindStrongModel(Of TModel) ( _
actionContext As HttpActionContext, _
parentBindingContext As ModelBindingContext, _
propertyName As String, _
metadataProvider As ModelMetadataProvider, _
<OutAttribute> ByRef model As TModel _
) As Boolean
'Usage
Dim actionContext As HttpActionContext
Dim parentBindingContext As ModelBindingContext
Dim propertyName As String
Dim metadataProvider As ModelMetadataProvider
Dim model As TModel
Dim returnValue As Boolean
returnValue = actionContext.TryBindStrongModel(parentBindingContext, _
propertyName, metadataProvider, _
model)
public static bool TryBindStrongModel<TModel>(
this HttpActionContext actionContext,
ModelBindingContext parentBindingContext,
string propertyName,
ModelMetadataProvider metadataProvider,
out TModel model
)
[ExtensionAttribute]
public:
generic<typename TModel>
static bool TryBindStrongModel(
HttpActionContext^ actionContext,
ModelBindingContext^ parentBindingContext,
String^ propertyName,
ModelMetadataProvider^ metadataProvider,
[OutAttribute] TModel% model
)
static member TryBindStrongModel :
actionContext:HttpActionContext *
parentBindingContext:ModelBindingContext *
propertyName:string *
metadataProvider:ModelMetadataProvider *
model:'TModel byref -> bool
JScript does not support generic types and methods.
Type Parameters
- TModel
The type of the model.
Parameters
actionContext
Type: System.Web.Http.Controllers.HttpActionContextThe execution context.
parentBindingContext
Type: System.Web.Http.ModelBinding.ModelBindingContextThe parent binding context.
propertyName
Type: System.StringThe name of the property to bind with the model.
metadataProvider
Type: System.Web.Http.Metadata.ModelMetadataProviderThe metadata provider for the model.
model
Type: TModel%When this method returns, contains the bound model.
Return Value
Type: System.Boolean
true if the bind succeeded; otherwise, false.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HttpActionContext. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).