DataModelModelBinder

Binds a complex model and initializes the properties configured within the application context.

Namespace:
Inetdev.AspNetCore.Binders
Type:
Class
Public:
Yes
Protected:
No
Sealed:
No
Abstract:
No
Inherits from:
Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexTypeModelBinder

Remarks

When an IDataProperty has protection set, this binder protects the data using:

If protection is Encripted the Cryptographer.EncryptToBase64String method is used.

If protection is Hash or Password the Cryptographer.ComputeHash is used and the result is then converted to a Base64 string.

Constructors

DataModelModelBinder

Initializes a new instance of DataModelModelBinder.

Signature:
public Void DataModelModelBinder(propertyBinders, loggerFactory)
Parameters
Name Type Summary
propertyBinders IDictionary<ModelMetadata, IModelBinder> The IDictionary`2 of binders to use for binding properties.
loggerFactory ILoggerFactory A ILoggerFactory.

Methods

CreateModel

Creates the object model from the application context.

Signature:
protected Object CreateModel(bindingContext)
Returns

An Object compatible with ModelType.

Parameters
Name Type Summary
bindingContext ModelBindingContext The ModelBindingContext.
Exceptions
Type Summary
ArgumentNullException Thrown when bindingContext is null.

SetProperty

Sets a model property value processing the property protection.

Signature:
protected Void SetProperty(bindingContext, modelName, propertyMetadata, result)
Parameters
Name Type Summary
bindingContext ModelBindingContext The ModelBindingContext.
modelName String The model name.
propertyMetadata ModelMetadata The ModelMetadata for the property to set.
result ModelBindingResult The ModelBindingResult for the property's new value.
Exceptions
Type Summary
ArgumentNullException Thrown when bindingContext is null.
ArgumentNullException Thrown when modelName is null.
ArgumentNullException Thrown when propertyMetadata is null.