structuremap - two implementations of same interface

前端 未结 4 421
悲哀的现实
悲哀的现实 2021-02-02 01:14

I have a service class with the following ctor:

public class (IMessageService emailService, IMessageService smsService)
{ ... }

and two impleme

4条回答
  •  礼貌的吻别
    2021-02-02 01:26

    Turns out named instances are one possible solution:

     _.For().Use().Named("emailService");
     _.For().Use().Named("smsService");
    

提交回复
热议问题