开发者

NServiceBus configuration interface question

开发者 https://www.devze.com 2023-01-20 07:21 出处:网络
In the NServiceBus interface, why are some things 开发者_Go百科configured like this: NServiceBus.Configure.Instance.Configurer.ConfigureComponent(ComponentCallModelEnum.Singleton);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消