Class MapperContext
Represents a mapper context.
Inheritance
System.Object
Namespace: Umbraco.Cms.Core.Mapping
Assembly: Umbraco.Core.dll
Syntax
public class MapperContext
Constructors
View SourceMapperContext(IUmbracoMapper)
Initializes a new instance of the MapperContext class.
Declaration
public MapperContext(IUmbracoMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IUmbracoMapper | 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 |
---|---|
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 |
---|---|---|
IEnumerable<TSourceElement> | source | The source objects. |
Returns
Type | Description |
---|---|
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. |