Profile questions

13 views
Skip to first unread message

cjm.ai...@gmail.com

unread,
Jun 1, 2017, 9:12:48 PM6/1/17
to AutoMapper-users
Some questions about Profiles...

I was kind of confused when you said:

"Configuration inside a profile only applies to maps inside the profile. Configuration applied to the root configuration applies to all maps created."

Questions:

1. What is the "root configuration"? Is that if I make like a BaseProfile class which my other Profiles inherit from?

2. Are you saying that in Profiles, configuration statements which would normally configure things globally will, in Profiles, only affect those mappings created in that Profile?

In other words, if I have this situation:

class BaseProfile : Profile {...}


class ProfileA : BaseProfile
{
public ProfileA()
{
this.ShouldMapField = fi => false;
this.CreateMap<SrcA, DestA>();
}

}


Then, the field mapping is turned off only for the SrcA => DestA mapping and not for other mappings?


Thanks.

Jimmy Bogard

unread,
Jun 2, 2017, 11:43:35 AM6/2/17
to automapper-users
The root configuration is the "MapperConfiguration" class that contains all profiles. When you do Mapper.Initialize(cfg => ...) or new MapperConfiguration, those are the root configs.

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages