Class MapperContext
Represents a mapper context.
Inheritance
System.Object
Namespace: Umbraco.Core.Mapping
Assembly: Umbraco.Core.dll
Syntax
public class MapperContext
Constructors
View SourceMapperContext(UmbracoMapper)
Initializes a new instance of the MapperContext class.
Declaration
public MapperContext(UmbracoMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
UmbracoMapper | mapper |
Properties
View SourceHasItems
Gets a value indicating whether the context has items.
Declaration
public bool HasItems { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Items
Gets the context items.
Declaration
public IDictionary<string, object> Items { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> |
Methods
View SourceMap<TTarget>(Object)
Maps a source object to a new target object.
Declaration
public TTarget Map<TTarget>(object source)
Parameters
Type | Name | Description |
---|---|---|
System.Object | source | The source object. |
Returns
Type | Description |
---|---|
TTarget | The target object. |
Type Parameters
Name | Description |
---|---|
TTarget | The target type. |
Map<TSource, TTarget>(TSource)
Maps a source object to a new target object.
Declaration
public TTarget Map<TSource, TTarget>(TSource source)
Parameters
Type | Name | Description |
---|---|---|
TSource | source | The source object. |
Returns
Type | Description |
---|---|
TTarget | The target object. |
Type Parameters
Name | Description |
---|---|
TSource | The source type. |
TTarget | The target type. |
Map<TSource, TTarget>(TSource, TTarget)
Maps a source object to an existing target object.
Declaration
public TTarget Map<TSource, TTarget>(TSource source, TTarget target)
Parameters
Type | Name | Description |
---|---|---|
TSource | source | The source object. |
TTarget | target | The target object. |
Returns
Type | Description |
---|---|
TTarget | The target object. |
Type Parameters
Name | Description |
---|---|
TSource | The source type. |
TTarget | The target type. |
MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement>)
Maps an enumerable of source objects to a new list of target objects.
Declaration
public List<TTargetElement> MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TSourceElement> | source | The source objects. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<TTargetElement> | A list containing the target objects. |
Type Parameters
Name | Description |
---|---|
TSourceElement | The type of the source objects. |
TTargetElement | The type of the target objects. |