Class ObjectSelectorBase<TProperties, TClientProperties, TFormComponentValue, TSingleItemValue>
Base class for object selector form component.
public abstract class ObjectSelectorBase<TProperties, TClientProperties, TFormComponentValue, TSingleItemValue> : FormComponent<TProperties, TClientProperties, TFormComponentValue>, IFormComponent, IFormItem<IFormComponentClientProperties>, IFormItem where TProperties : ObjectSelectorPropertiesBase, new() where TClientProperties : ObjectSelectorClientPropertiesBase<TFormComponentValue, TSingleItemValue>, new()
Type Parameters
TPropertiesTClientPropertiesTFormComponentValueTSingleItemValue
- Inheritance
-
objectFormComponent<TProperties, TClientProperties, TFormComponentValue>ObjectSelectorBase<TProperties, TClientProperties, TFormComponentValue, TSingleItemValue>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ObjectSelectorBase(IObjectsRetriever, IObjectSelectorWhereConditionProviderActivator, ILocalizationService)
Constructor.
protected ObjectSelectorBase(IObjectsRetriever objectsRetriever, IObjectSelectorWhereConditionProviderActivator whereConditionProviderActivator, ILocalizationService localizationService)
Parameters
objectsRetrieverIObjectsRetrieverObjects retriever.
whereConditionProviderActivatorIObjectSelectorWhereConditionProviderActivatorWHERE condition provider activator.
localizationServiceILocalizationServiceLocalization service.
Exceptions
- ArgumentNullException
If
objectsRetriever,whereConditionProviderActivatororlocalizationServiceis null.
Methods
ConfigureClientProperties(TClientProperties)
Configures the form component client properties.
protected override Task ConfigureClientProperties(TClientProperties clientProperties)
Parameters
clientPropertiesTClientPropertiesThe current instance of the form component client properties.
Returns
- Task
Remarks
Override this method in order to configure form component client properties.
ConvertFormComponentSingleItemValue(IEnumerable<TSingleItemValue>)
Extracts an array of selected object identifiers from a collection containing items of a the TSingleItemValue type.
protected abstract IEnumerable<string> ConvertFormComponentSingleItemValue(IEnumerable<TSingleItemValue> value)
Parameters
valueIEnumerable<TSingleItemValue>Component value.
Returns
- IEnumerable<string>
ConvertFormComponentValue(TFormComponentValue)
Extracts an array of selected object identifiers from component value for the sake of providing selected objects meta data to the client component.
protected abstract IEnumerable<string> ConvertFormComponentValue(TFormComponentValue value)
Parameters
valueTFormComponentValueComponent value.
Returns
- IEnumerable<string>
ExtractValue(IDataContainer, ObjectTypeInfo)
Enables IObjectsRetriever to create an element from a source data.
protected abstract TSingleItemValue ExtractValue(IDataContainer dataContainer, ObjectTypeInfo typeInfo)
Parameters
dataContainerIDataContainerSource data.
typeInfoObjectTypeInfoType info.
Returns
- TSingleItemValue
GetSelectedObjects()
Returns an items list of the form component selected value.
protected Task<IEnumerable<ObjectSelectorListItem<TSingleItemValue>>> GetSelectedObjects()
Returns
- Task<IEnumerable<ObjectSelectorListItem<TSingleItemValue>>>
GetValidValueCollection()
Return a collection of selected items that are valid only.
protected Task<IEnumerable<TSingleItemValue>> GetValidValueCollection()
Returns
- Task<IEnumerable<TSingleItemValue>>
LoadObjects(LoadObjectsCommandArgs, CancellationToken)
Loads items into a selection list.
[FormComponentCommand]
public Task<ICommandResponse<LoadObjectsCommandResult<TSingleItemValue>>> LoadObjects(LoadObjectsCommandArgs args, CancellationToken cancellationToken)
Parameters
argsLoadObjectsCommandArgsCommand arguments.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ICommandResponse<LoadObjectsCommandResult<TSingleItemValue>>>
LoadSelectedObjects(LoadSelectedObjectsCommandArgs<TSingleItemValue>, CancellationToken)
Loads selected items data.
[FormComponentCommand]
public Task<ICommandResponse<LoadSelectedObjectsCommandResult<TSingleItemValue>>> LoadSelectedObjects(LoadSelectedObjectsCommandArgs<TSingleItemValue> args, CancellationToken cancellationToken)
Parameters
argsLoadSelectedObjectsCommandArgs<TSingleItemValue>Command arguments.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<ICommandResponse<LoadSelectedObjectsCommandResult<TSingleItemValue>>>