Multiple Interface injection with castle windsor

后端 未结 3 604
误落风尘
误落风尘 2020-12-29 00:23

How can you get castle Windsor to choose the right implantation of a interface at run time when you have multiple implementations in the container.

For example lets

3条回答
  •  不思量自难忘°
    2020-12-29 00:56

    Multi-tenancy is defined as being able to run your software on one instance, serving multiple tenants/customers/clients. I guess you could run into problems like yours more often in a multi-tenancy setup.

    All your components have keys which are unique strings, so you may always so a container.Resolve("someKey") to get a specific implementation.

    If you want to have a specific implementation automatically injected, you may configure your component like this (off my memory, may not be 100% precise):

    
    
    
        
             
               ${someService.customer1}
            
         
    
    

提交回复
热议问题