Skip to content

Create map

Bert Loedeman edited this page Sep 28, 2015 · 3 revisions

automapper.createMap

The createMap function registers a mapping profile. AutoMapper by default maps all properties which are equally named and typed in the source and destination object types. Since JavaScript typing is very limited, this implementation by default creates a destination object with identical property names and values as the source object. However, this behaviour can be changed using custom mapping configuration.

The return type of the createMap function is the IAutoMapperCreateMapChainingFunctions interface, offering the following public functions:

forMember: (sourceProperty: string, valueOrFunction: any);
forSourceMember: (sourceProperty: string, sourceMemberConfigurationFunction: (opts: ISourceMemberConfigurationOptions) => void);
forAllMembers: (func: (destinationObject: any, destinationPropertyName: string, value: any) => void);
ignoreAllNonExisting: ();
convertUsing: (typeConverterClassOrFunction: any);
convertToType: (typeClass: new () => any);

Find out more about each function by following its link:

Clone this wiki locally