Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"?

like image 306
jenson-button-event Avatar asked Nov 18 '11 15:11

jenson-button-event


1 Answers

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.

like image 138
Mark Seemann Avatar answered Sep 27 '22 15:09

Mark Seemann