Skip to content

create map for source member

Bert Loedeman edited this page Aug 27, 2015 · 1 revision

forSourceMember

The createMap.forSourceMember function specifies what action has to be performed when mapping a certain source member.

Ignore a source property

createMap.forSourceMember function sample to ignore a source property.

automapper
	.createMap(fromKey, toKey)
	.forSourceMember('prop', (opts: AutoMapperJs.ISourceMemberConfigurationOptions) => { opts.ignore(); });

Provide a custom value for a source property

createMap.forSourceMember function sample to provide a custom value for a source property. Probably, this is not very useful; it should slow down the libray if we should try to prevent this functionality, so let's allow it for now - please inform us if you find business value in this functionality ;) ...

automapper
    .createMap(fromKey, toKey)
    .forSourceMember('prop1', (opts: AutoMapperJs.ISourceMemberConfigurationOptions) => { return 'Yeah!'; });

Clone this wiki locally