Class ModelMapping
- Namespace
- Dynamicweb.CoreUI.Data
- Assembly
- Dynamicweb.CoreUI.dll
public sealed class ModelMapping
- Inheritance
-
ModelMapping
- Inherited Members
Properties
Explanation
public string Explanation { get; init; }
Property Value
Hint
public string Hint { get; init; }
Property Value
IsSearchable
public bool IsSearchable { get; init; }
Property Value
IsSortable
public bool IsSortable { get; init; }
Property Value
Label
public string Label { get; init; }
Property Value
Name
public required string Name { get; init; }
Property Value
SystemName
public required string SystemName { get; init; }
Property Value
ValueType
public Type? ValueType { get; init; }
Property Value
Methods
CreateFromConfigurableProperty<TModel, TValue>(Expression<Func<TModel, TValue>>)
Creates model mapping from model property having ConfigurablePropertyAttribute.
public static ModelMapping CreateFromConfigurableProperty<TModel, TValue>(Expression<Func<TModel, TValue>> propertyExpression)
Parameters
propertyExpressionExpression<Func<TModel, TValue>>The property mapping expression
Returns
- ModelMapping
Model mapping
Type Parameters
TModelMapping value expression input model type
TValueMapping value expression output value type
Exceptions
- ArgumentException
Thrown when expression have invalid member target. Must reference a property on
TModel.- InvalidOperationException
Thrown when the property doesn't have ConfigurablePropertyAttribute
Create<TModel, TValue>(Func<TModel?, TValue?>, string, string?, bool, string?, string?, string?, bool)
Creates model mapping with specified value expression, mapping name, label, sortable behavior, system name, hind and explanation
public static ModelMapping Create<TModel, TValue>(Func<TModel?, TValue?> getModelValue, string mappingName, string? systemName = null, bool isSortable = false, string? label = null, string? hint = null, string? explanation = null, bool isSearchable = false)
Parameters
getModelValueFunc<TModel, TValue>The mapping value expression
mappingNamestringMapping name. Required.
systemNamestringMapping system name, if not set - mapping name will be used.
isSortableboolSortable behavior
labelstringMapping label, if not set - mapping name will be used.
hintstringHint
explanationstringExplanation
isSearchableboolSearchable behavior
Returns
- ModelMapping
Model mapping
Type Parameters
TModelMapping value expression input model type
TValueMapping value expression output value type
Remarks
Only allowed to use for select providers. Any other cases should be used CreateFromConfigurableProperty<TModel, TValue>(Expression<Func<TModel, TValue>>).
Exceptions
- ArgumentException
Thrown when the mapping name is not specified.
GetValue(object?)
public object? GetValue(object? model)
Parameters
modelobject