-
Notifications
You must be signed in to change notification settings - Fork 3
Multimap by default
Isaac Abraham edited this page Jan 26, 2016
·
7 revisions
Out of the box, multimapping is a manual option i.e. you must turn it on on a case-by-case basis. You can change this by specifying the MultimappingByDefault mapping behaviour. This behaviour instructs the Automapper that when multiple implementations for a given interface are found, instead of throwing an exception it will act as though the Multimap option was applied for that interface.
public interface ICommand { }
class BackupCommand : ICommand { }
class QuitCommand : ICommand { }
container.AutomapAssemblies(new MappingOptions(MappingBehaviours.MultimapByDefault), "MyAssembly");
// commands contains both BackupCommand and QuitCommand
var commands = container.ResolveAll<ICommand>();