Search Results for

    Show / Hide Table of Contents
    View Source

    Class UmbracoMapper

    Umbraco Mapper.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Mapping
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class UmbracoMapper : IUmbracoMapper
    Remarks

    When a map is defined from TSource to TTarget, the mapper automatically knows how to map from IEnumerable{TSource} to IEnumerable{TTarget} (using a List{TTarget}) and to TTarget[].

    When a map is defined from TSource to TTarget, the mapper automatically uses that map for any source type that inherits from, or implements, TSource.

    When a map is defined from TSource to TTarget, the mapper can map to TTarget exclusively and cannot re-use that map for types that would inherit from, or implement, TTarget.

    When using the Map{TSource, TTarget}(TSource source, ...) overloads, TSource is explicit. When using the Map{TTarget}(object source, ...) TSource is defined as source.GetType().

    In both cases, TTarget is explicit and not typeof(target).

    Constructors

    View Source

    UmbracoMapper(MapDefinitionCollection, ICoreScopeProvider)

    Initializes a new instance of the UmbracoMapper class.

    Declaration
    public UmbracoMapper(MapDefinitionCollection profiles, ICoreScopeProvider scopeProvider)
    Parameters
    Type Name Description
    MapDefinitionCollection profiles
    ICoreScopeProvider scopeProvider
    View Source

    UmbracoMapper(MapDefinitionCollection, ICoreScopeProvider, ILogger<UmbracoMapper>)

    Initializes a new instance of the UmbracoMapper class.

    Declaration
    public UmbracoMapper(MapDefinitionCollection profiles, ICoreScopeProvider scopeProvider, ILogger<UmbracoMapper> logger)
    Parameters
    Type Name Description
    MapDefinitionCollection profiles

    The MapDefinitionCollection

    ICoreScopeProvider scopeProvider

    The scope provider

    ILogger<UmbracoMapper> logger

    The logger

    Methods

    View Source

    Define<TSource, TTarget>()

    Defines a mapping.

    Declaration
    public void Define<TSource, TTarget>()
    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Define<TSource, TTarget>(Action<TSource, TTarget, MapperContext>)

    Defines a mapping.

    Declaration
    public void Define<TSource, TTarget>(Action<TSource, TTarget, MapperContext> map)
    Parameters
    Type Name Description
    Action<TSource, TTarget, MapperContext> map

    A mapping method.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Define<TSource, TTarget>(Func<TSource, MapperContext, TTarget>)

    Defines a mapping.

    Declaration
    public void Define<TSource, TTarget>(Func<TSource, MapperContext, TTarget> ctor)
    Parameters
    Type Name Description
    Func<TSource, MapperContext, TTarget> ctor

    A constructor method.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Define<TSource, TTarget>(Func<TSource, MapperContext, TTarget>, Action<TSource, TTarget, MapperContext>)

    Defines a mapping.

    Declaration
    public void Define<TSource, TTarget>(Func<TSource, MapperContext, TTarget> ctor, Action<TSource, TTarget, MapperContext> map)
    Parameters
    Type Name Description
    Func<TSource, MapperContext, TTarget> ctor

    A constructor method.

    Action<TSource, TTarget, MapperContext> map

    A mapping method.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Map<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.

    View Source

    Map<TTarget>(Object, Action<MapperContext>)

    Maps a source object to a new target object.

    Declaration
    public TTarget Map<TTarget>(object source, Action<MapperContext> f)
    Parameters
    Type Name Description
    System.Object source

    The source object.

    Action<MapperContext> f

    A mapper context preparation method.

    Returns
    Type Description
    TTarget

    The target object.

    Type Parameters
    Name Description
    TTarget

    The target type.

    View Source

    Map<TTarget>(Object, MapperContext)

    Maps a source object to a new target object.

    Declaration
    public TTarget Map<TTarget>(object source, MapperContext context)
    Parameters
    Type Name Description
    System.Object source

    The source object.

    MapperContext context

    A mapper context.

    Returns
    Type Description
    TTarget

    The target object.

    Type Parameters
    Name Description
    TTarget

    The target type.

    View Source

    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.

    View Source

    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.

    View Source

    Map<TSource, TTarget>(TSource, TTarget, Action<MapperContext>)

    Maps a source object to an existing target object.

    Declaration
    public TTarget Map<TSource, TTarget>(TSource source, TTarget target, Action<MapperContext> f)
    Parameters
    Type Name Description
    TSource source

    The source object.

    TTarget target

    The target object.

    Action<MapperContext> f

    A mapper context preparation method.

    Returns
    Type Description
    TTarget

    The target object.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Map<TSource, TTarget>(TSource, TTarget, MapperContext)

    Maps a source object to an existing target object.

    Declaration
    public TTarget Map<TSource, TTarget>(TSource source, TTarget target, MapperContext context)
    Parameters
    Type Name Description
    TSource source

    The source object.

    TTarget target

    The target object.

    MapperContext context

    A mapper context.

    Returns
    Type Description
    TTarget

    The target object.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Map<TSource, TTarget>(TSource, Action<MapperContext>)

    Maps a source object to a new target object.

    Declaration
    public TTarget Map<TSource, TTarget>(TSource source, Action<MapperContext> f)
    Parameters
    Type Name Description
    TSource source

    The source object.

    Action<MapperContext> f

    A mapper context preparation method.

    Returns
    Type Description
    TTarget

    The target object.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    Map<TSource, TTarget>(TSource, MapperContext)

    Maps a source object to a new target object.

    Declaration
    public TTarget Map<TSource, TTarget>(TSource source, MapperContext context)
    Parameters
    Type Name Description
    TSource source

    The source object.

    MapperContext context

    A mapper context.

    Returns
    Type Description
    TTarget

    The target object.

    Type Parameters
    Name Description
    TSource

    The source type.

    TTarget

    The target type.

    View Source

    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.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.

    View Source

    MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement>, Action<MapperContext>)

    Maps an enumerable of source objects to a new list of target objects.

    Declaration
    public List<TTargetElement> MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement> source, Action<MapperContext> f)
    Parameters
    Type Name Description
    System.Collections.IEnumerable<TSourceElement> source

    The source objects.

    Action<MapperContext> f

    A mapper context preparation method.

    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.

    View Source

    MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement>, MapperContext)

    Maps an enumerable of source objects to a new list of target objects.

    Declaration
    public List<TTargetElement> MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement> source, MapperContext context)
    Parameters
    Type Name Description
    System.Collections.IEnumerable<TSourceElement> source

    The source objects.

    MapperContext context

    A mapper context.

    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.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • UmbracoMapper(MapDefinitionCollection, ICoreScopeProvider)
      • UmbracoMapper(MapDefinitionCollection, ICoreScopeProvider, ILogger<UmbracoMapper>)
    • Methods
      • Define<TSource, TTarget>()
      • Define<TSource, TTarget>(Action<TSource, TTarget, MapperContext>)
      • Define<TSource, TTarget>(Func<TSource, MapperContext, TTarget>)
      • Define<TSource, TTarget>(Func<TSource, MapperContext, TTarget>, Action<TSource, TTarget, MapperContext>)
      • Map<TTarget>(Object)
      • Map<TTarget>(Object, Action<MapperContext>)
      • Map<TTarget>(Object, MapperContext)
      • Map<TSource, TTarget>(TSource)
      • Map<TSource, TTarget>(TSource, TTarget)
      • Map<TSource, TTarget>(TSource, TTarget, Action<MapperContext>)
      • Map<TSource, TTarget>(TSource, TTarget, MapperContext)
      • Map<TSource, TTarget>(TSource, Action<MapperContext>)
      • Map<TSource, TTarget>(TSource, MapperContext)
      • MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement>)
      • MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement>, Action<MapperContext>)
      • MapEnumerable<TSourceElement, TTargetElement>(IEnumerable<TSourceElement>, MapperContext)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX