-
Notifications
You must be signed in to change notification settings - Fork 36
Create map
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:
AutoMapperTS is Copyright © 2015 Bert Loedeman and other contributors under the MIT license.
Getting started
Mapping performance
Initialization (initialize)
Mapping configuration (createMap)
- forMember
- forSourceMember
- condition
- forAllMembers
- ignoreAllNonExisting
- convertToType
- convertUsing
- withProfile
Validation (assertConfigurationIsValid)
Mapping (map)
Currying
Custom type converters
Profiles
Chaining
Naming conventions
Asynchronous mapping
Flattening and nesting