Table of Contents

Class DefaultErrorMappingFactory

Namespace
MRX.UI.ErrorsAutoWiring.Wiring
Assembly
MRX.UI.ErrorsAutoWiring.dll

Default IErrorMappingFactory implementation, which maps coded errors onto model fields using the "X-Disambiguated" response header to determine whether error keys are prefixed with their binding source.

public class DefaultErrorMappingFactory : IErrorMappingFactory
Inheritance
DefaultErrorMappingFactory
Implements
Inherited Members

Constructors

DefaultErrorMappingFactory(IModelKeyPathVisitor)

Default IErrorMappingFactory implementation, which maps coded errors onto model fields using the "X-Disambiguated" response header to determine whether error keys are prefixed with their binding source.

public DefaultErrorMappingFactory(IModelKeyPathVisitor modelVisitor)

Parameters

modelVisitor IModelKeyPathVisitor

The visitor used to resolve key paths against binding source models.

Methods

CreateErrorFieldMap(EditContext, Dictionary<string, CodedError[]>, HttpResponseMessage)

Builds a map of field identifiers to their associated coded errors.

public Dictionary<FieldIdentifier, List<CodedError>> CreateErrorFieldMap(EditContext editContext, Dictionary<string, CodedError[]> errors, HttpResponseMessage response)

Parameters

editContext EditContext

The edit context whose model must be a DataBindingSources instance.

errors Dictionary<string, CodedError[]>

The coded errors, keyed by the server-provided error key.

response HttpResponseMessage

The HTTP response the errors were extracted from; must include a valid "X-Disambiguated" header.

Returns

Dictionary<FieldIdentifier, List<CodedError>>

A dictionary linking each resolved field identifier to the list of errors that apply to it.

Exceptions

InvalidOperationException

Thrown when editContext's model is not a DataBindingSources, or the "X-Disambiguated" header is missing or invalid.