0

I want to set the DryIoC container to a default convention mapping (for example: resolve IFoo to Foo and IBar to Bar).

How can this be achieved ?

Patrick Peters
  • 9,456
  • 7
  • 57
  • 106
  • I cant find any such scenario in the documentation https://bitbucket.org/dadhi/dryioc/wiki/RulesAndDefaultConventions#markdown-header-rules-and-default-conventions – Thorarins Oct 06 '16 at 11:24
  • According to this list it should be: http://www.palmmedia.de/blog/2011/8/30/ioc-container-benchmark-performance-comparison – Patrick Peters Oct 06 '16 at 11:27
  • You want to automatically register all types from given assembly? – Evk Oct 06 '16 at 11:29
  • I want the IoC container to resolve any implementation based on a naming convention. It should be able to find any implementation from the composition root as starting point. – Patrick Peters Oct 06 '16 at 11:32
  • So to clarify, if class Foo implements IFoo - you want it to be registered and resolve. But if Bar implements something other than IBar (IService) - it should not be registered and resolvable. – Evk Oct 06 '16 at 11:37
  • try something like this container.RegisterMany(AssemblySource.Instance, serviceTypeCondition: type => type.Name.Equals( type.GetInterface("I" + type.Name).Name ) ); – Thorarins Oct 06 '16 at 12:08
  • Does it mean FooBar should not be resolved? – dadhi Oct 06 '16 at 14:38
  • WithAutoFallbackResolution may be also your choice, or just check how it is implemented - just a sugar on top of WithUnknownServiceResolvers. But I would suggest to be more explicit with RegisterMany. – dadhi Oct 06 '16 at 15:10

0 Answers0