🧙‍♂️
Dynamic Mapper
  • DynamicMapper
  • Getting started
  • Configuration
    • Member configuration
    • Subtyping
  • Profiles
  • Integrations
    • Angular
Powered by GitBook
On this page

Was this helpful?

Profiles

You can organize your mapping with profiles. Simply extend Profile and defined your configuration inside the constructor. Custom profiles need to be registered to the mapper configuration.

import { Profile, MappingProfile } from '@dynamic-mapper/mapper';

class CustomerProfile extends Profile {
    static readonly DtoToDomain = new MappingProfile<CustomerDto, Customer>();

    constructor() {
        this.createMap(CustomerProfile.DtoToDomain, {
            fullName: opt => opt.ignore()
        });
    }
}

Later register profiles to the mapper configuration.

const config = new MapperConfiguration(cfg => {
    cfg.addProfile(new CustomerProfile());
});
PreviousSubtypingNextAngular

Last updated 5 years ago

Was this helpful?