You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Isaac Abraham edited this page Jan 26, 2016
·
6 revisions
###Scenario
Unity will simply overwrite named registrations with the latest one it gets (kind of a "last past the post" behaviour). To prevent accidentally missing mappings, if the Automapper finds two mappings for the same interface with the same name, it throws an exception.
###Example
publicinterfaceIMyService{}[MapAs("Foo")]publicclassMyService:IMyService{}[MapAs("Foo")]publicclassMyOtherService:IMyService{}// "Foo" is duplicated.
###How do I fix this?
Change the explicit named mapping to something else.
Use the implicit MultimapByDefault behaviour, which will automatically generate registration names based on the concrete type being mapped.