tags:

views:

18

answers:

1

In the NServiceBus interface, why are some things configured like this:

NServiceBus.Configure.Instance.Configurer.ConfigureComponent(ComponentCallModelEnum.Singleton);

And some things are configured like this:

NServiceBus.Configure.With().DoNotAutoSubscribe();

What is the significance of "Instance" here?

A: 

In the first case you are configuring a specific component into the NSB container. For instance you may want to load an NH ISessionFactory into the NSB container as a singleton object. In the second case you are configuring NSB behaviour. The "Instance" is simply a way to statically access the Configure class. Using "With" forces certain configuration behaviour including the order in which things are configured.

Adam Fyles