adic icon indicating copy to clipboard operation
adic copied to clipboard

Add binding to all interfaces that a given type implements

Open intentor opened this issue 9 years ago • 2 comments

The idea is to create a binding action that binds to all interfaces of a given type, like:

  • a class of name MyClass implements IInterface1, IInterface2, IInterface3.
  • to bind all of these interfaces to e.g. a singleton of MyClass, something like container.BindToInterfaces<MyClass>().ToSingleton<MyClass>() could be done.

The BindToInterfaces<T>() could receive classes or interfaces.

It could be also created a method that bounds to all inherited and implemented types of a given type.

intentor avatar Jul 08 '16 14:07 intentor

The name of the methods could be BindInterfacesFrom<T>() and BindClassFrom<T>().

intentor avatar Jul 08 '16 19:07 intentor

This issue could be improved by adding a To() and ToSingleton methods using anonymous functions with a type definition object, so it's possible to create custom To definitions.

intentor avatar Dec 09 '16 23:12 intentor