2
nServiceBusで見たすべてのサンプルでは、IOCプロパティの注入に具体的なクラスが使用されています。インターフェイスを登録するにはどうすればいいですか?以下のサンプルでは、SmtpClientProxy(私が作成した具象クラス)を返すためにISmtpClientをどのように登録しますか?nServiceBus IOCインターフェイス
public class EmailNotificationMessageHandler : IHandleMessages<EmailNotificationMessage>
{
public ISmtpClient Smtp { get; set; }
public void Handle(EmailNotificationMessage message)
{
//this.Smtp = new SmtpClient("localhost", 25);
this.Smtp.SendAsync(message.FromAddress, message.ToAddress, message.Subject, message.Body, message.Id);
}
}
私の設定はこのように見えますが、私は具体的な型にどのように表示されていない(私はシングルトンを望んでいない)
Configure.With().CastleWindsorBuilder().JsonSerializer();
Configure.Instance.Configurer.ConfigureComponent<ISmtpClient>(DependencyLifecycle.InstancePerCall);
また、へのアクセスを取得する方法があります実際のコンテナ(私の場合はウィンザー)は、私が欲しい他の登録用のものをやっていますか?