MapValueAttribute
Namespace: Riok.Mapperly.Abstractions
Specifies a constant value mapping.
public sealed class MapValueAttribute : System.Attribute
Inheritance Object → Attribute → MapValueAttribute
Attributes NullableContextAttribute, NullableAttribute, AttributeUsageAttribute, ConditionalAttribute
Properties
Target
Gets the name of the target property.
public IReadOnlyCollection<string> Target { get; }
Property Value
TargetFullName
Gets the full name of the target property path.
public string TargetFullName { get; }
Property Value
Value
Gets the value to be assigned to MapValueAttribute.Target.
public object Value { get; }
Property Value
Use
Gets or sets the method name of the method which generates the value to be assigned to MapValueAttribute.Target. Either this property or MapValueAttribute.Value needs to be set. The return type of the referenced method must exactly match the type of MapValueAttribute.Target and needs to be parameterless. The usage of nameof is encouraged.
public string Use { get; set; }
Property Value
TypeId
public object TypeId { get; }
Property Value
Constructors
MapValueAttribute(String, Object)
Maps a constant value to a target member.
public MapValueAttribute(string target, object value)
Parameters
target
String
The target member path.
value
Object
The value to assign to the target
, needs to be of the same type as the target
.
MapValueAttribute(String[], Object)
Maps a constant value to a target member.
public MapValueAttribute(String[] target, object value)
Parameters
target
String[]
The target member path.
value
Object
The value to assign to the target
, needs to be of the same type as the target
.
MapValueAttribute(String)
Maps a method generated value to a target member. Requires the usage of the MapValueAttribute.Use property.
public MapValueAttribute(string target)
Parameters
target
String
The target member path.
MapValueAttribute(String[])
Maps a method generated value to a target member. Requires the usage of the MapValueAttribute.Use property.
public MapValueAttribute(String[] target)
Parameters
target
String[]
The target member path, the usage of nameof is encouraged.