In the NServiceBus interface, why are some things 开发者_Go百科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?
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.
精彩评论