MappedTo.matchinginterface missing

May 16, 2013 at 11:20 AM
Hi all,

i'm probably looking in the wrong place, but i can't seem to use the convention based mappings..

I've added the latest version of unity using nuget

then I tried this code:
  // register all your components with the container here
  // it is NOT necessary to register your controllers
  container.RegisterTypes(
AllClasses.FromLoadedAssemblies(), //uses reflection
MappedTo.MatchingInterface, //Matches Interfaces to implementations by name
WithName.Default);

It looks like it can't find MappedTo.MatchingInterface, so my app won't compile.

I also downloaded the source of unity 3 and can't find it either.. am I looking in the wrong place?

thanks,
Erwin
May 16, 2013 at 4:39 PM
I think that the final implementation has changed slightly. This should do what you want:
container.RegisterTypes(
    AllClasses.FromLoadedAssemblies(),
    WithMappings.FromMatchingInterface,
    WithName.Default);

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to