Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7647351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:26:26+00:00 2026-05-31T10:26:26+00:00

Every sample that I’ve seen for nServiceBus has used concrete class for IOC property

  • 0

Every sample that I’ve seen for nServiceBus has used concrete class for IOC property injection. How do I register an interface? In the sample below, how do I register ISmtpClient to return SmtpClientProxy (a concrete class that I’ve created)?

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);
        }
    }

My configuration looks like this, but I don’t see how to the concrete type (I don’t want a Singleton)

Configure.With().CastleWindsorBuilder().JsonSerializer();

Configure.Instance.Configurer.ConfigureComponent<ISmtpClient>(DependencyLifecycle.InstancePerCall);

Also, is there a way to get access to the actual container (Windsor in my case) to do any other registration stuff that I want?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:26:27+00:00Added an answer on May 31, 2026 at 10:26 am

    You can pass nServiceBus the container to use and you can reference it after:

     _container = new WindsorContainer();
    
    Configure.With().CastleWindsorBuilder(_container).JsonSerializer();
    
     _container.AddComponent<ISmtpClient, CustomSmtpClient>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Every sample that I have seen uses static XML in the xmldataprovider source, which
every introduction and sample that I can find seems to use GLUT or some
Almost every Python web framework has a simple server that runs a wsgi application
Every sample I've seen uses stored procedures. I've adopted an old application written in
lets say i have classA which is a class of audio,that sample the audio
I have tried every sample of code I can find that defines and runs
I want to write a C program that will sample something every second (an
I'm trying to do something seemingly simple: ensure that Application_BeginRequest is called for every
I'm new to development on the iPhone. Just about every sample project (as well
Consider the following code sample that uses MEF to create an object of type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.