Search code examples
inversion-of-controlcastle-windsor

IoC (Windsor) - What is a "Default Interface"?


Can someone please explain the difference between

container.Register(AllTypes.FromAssemblyContaining(typeof(BigCompanyRepository))
 .WithService.DefaultInterface()

and

container.Register(AllTypes.FromAssemblyContaining(typeof(BigCompanyRepository))
 .WithService.AllInterfaces()

What is meant by a "default interface"?


Solution

  • It's a heuristic that looks for an implementation of an interface by removing the leading I:

    • IFoo -> Foo
    • IBar -> Bar
    • IKitchenSink -> KitchenSink

    However, in my opinion, using this feature smells of an over-abundance of 1:1 interfaces.