InputComponentBaseT Class

This is the base razor component for a form input field for a business object property.
It has to be used on EditForms where an EditContext is applied; the component will derive the value from there.

Definition

Namespace: MobileTrack.Web.Components.Views
Assembly: MobileTrack.Web.Components (in MobileTrack.Web.Components.dll) Version: 0.7+45c8d9adb5970d727cceec44a5ed61aea0016e50
public abstract class InputComponentBase<T> : ComponentBase, 
	IHasLocalization, IDisposable
where T : class
Inheritance
Object    ComponentBase    InputComponentBaseT
Derived
More
Implements
IHasLocalization, IDisposable

Type Parameters

T
Business object the form is based on.

Constructors

InputComponentBaseTInitializes a new instance of the InputComponentBaseT class

Properties

EditContext EditContext of the Form the input component is a part of.
The EditForm cascades the EditContext downwards.
Id ID to render for HTML/JS interop
Loc Dependency injection for the localization tool. It derives texts established in CosmosDB's "LocalizedStrings" container. It can be used by invoking it as an array, with the key of the text you want to get. Parameters for the string can be added in the array as well, similar to Format(String, Object).
If the text is not found, it will return the key itself as fallback.

The language the key will be localized based on is based on the CurrentCulture and the CurrentUICulture.
If you want to localize something in a different language, you will have to apply the culture on the CultureInfo properties, get the text,
and revert back to the original culture.
Model Model to get the data from, which is derived from the EditContext.
This property will be null if the Model isn't set, or if T isn't the type of the Model.
The property assumes that the EditContext is set properly, and a Assert(Boolean) is placed in the OnParametersSet method as a safeguard.

Methods

DisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
GetInputStatusCssClass Get input status
GetPropertyNameTSource, TProperty Returns name of the property. (class -> property) must be the input.
SetParametersAsync Sets parameters supplied by the component's parent in the render tree.
(Overrides ComponentBaseSetParametersAsync(ParameterView))

Exceptions

NullReferenceException This is thrown if we're trying to access the EditContext, cascaded down from the EditForm,
if T isn't the type used in the EditContext's Model

See Also