CreateMap

Entry point for building an object mapper configuration in a fluent way

  1. class CreateMap(TSource, TDest, Configs...)
    class CreateMap : ObjectMapperConfig!(TSource, TDest, findOrDefault!(isSourceNamingConventionConfig, SourceNamingConventionConfig!CamelCaseNamingConvention, Configs).Convention, findOrDefault!(isDestNamingConventionConfig, DestNamingConventionConfig!CamelCaseNamingConvention, Configs).Convention, onlyOneExists!(isReverseMapConfig, Configs), Filter!(isObjectMemberMappingConfig, Configs))(
    TSource
    TDest
    Configs...
    ) if (
    isClassOrStruct!TSource &&
    isClassOrStruct!TDest
    ) {}
  2. class CreateMap(A, B)

Members

Templates

DestMemberNaming
template DestMemberNaming(TConv)

Set dest. naming convention

ForMember
template ForMember(string DestMember, string SrcMember)

Precise a member mapping

ForMember
template ForMember(string DestMember, alias Delegate)

Customize member mapping with a delegate

Ignore
template Ignore(string DestMember)

Ignore a member

ReverseMap
template ReverseMap()

Tell to reverse the mapper automatically

SourceMemberNaming
template SourceMemberNaming(TConv)

Set source naming convention

Examples

import automapper : MapperConfiguration, CreateMap;

static class A {
    string foo;
    int bar;
}

static class B {
    string qux;
    int baz;
}

MapperConfiguration!(
    CreateMap!(A, B)
        .ForMember!("qux", "foo")
        .ForMember!("baz", "foo"))
            .createMapper();

Meta