Castle Windsor - multiple implementation of an interface

前端 未结 4 1551
小鲜肉
小鲜肉 2020-12-09 16:02

While registering components in Castle Windsor, how do we bind specific implementation of an interface to a component that has a dependency on that interface. I know in adva

4条回答
  •  没有蜡笔的小新
    2020-12-09 16:33

    If you want to do it at runtime, This can be acheived through IHandlerSelector. Write a class that implements IHandlerSelector. It provides a method SelectHandler which will let you define the condition for binding conditionally at runtime. A Handler in this case is a component in Windsor that participates in instance construction. Refer here for more details.

提交回复
热议问题