在NServiceBus 5中获取EndPointName

在NServiceBus 5中获取EndPointName,nservicebus,nservicebus4,nservicebus5,nservicebus-configuration,Nservicebus,Nservicebus4,Nservicebus5,Nservicebus Configuration,我正在将我的应用程序从NServiceBus4升级到5 我有一个类实现了iwanttorunhenbusstartsandstops,并在Start()方法上打印出EndpointName-从NServiceBus.Configure.EndpointName 在NServiceBus 5上,它已被弃用,我希望正确地使用它。如何获取EndpointName?您可以使用ReadOnlySetting实例,查看以下示例: class MyClass : IWantToRunWhenBusStarts

我正在将我的应用程序从NServiceBus4升级到5

我有一个类实现了
iwanttorunhenbusstartsandstops
,并在
Start()
方法上打印出EndpointName-从
NServiceBus.Configure.EndpointName


在NServiceBus 5上,它已被弃用,我希望正确地使用它。如何获取EndpointName?

您可以使用
ReadOnlySetting
实例,查看以下示例:

class MyClass : IWantToRunWhenBusStartsAndStops
{
    public ReadOnlySettings Settings{ get; set; }

    public void Start()
    {
        var name = this.Settings.EndpointName();
    }

    public void Stop()
    {

    }
}

其中,
EndpointName()
是NServiceBus在
NServiceBus
命名空间中提供的扩展方法。

您可以使用一个
ReadOnlySetting
实例,查看以下示例:

class MyClass : IWantToRunWhenBusStartsAndStops
{
    public ReadOnlySettings Settings{ get; set; }

    public void Start()
    {
        var name = this.Settings.EndpointName();
    }

    public void Stop()
    {

    }
}

其中,
EndpointName()
是NServiceBus在
NServiceBus
命名空间中提供的扩展方法。

您可以使用一个
ReadOnlySetting
实例,查看以下示例:

class MyClass : IWantToRunWhenBusStartsAndStops
{
    public ReadOnlySettings Settings{ get; set; }

    public void Start()
    {
        var name = this.Settings.EndpointName();
    }

    public void Stop()
    {

    }
}

其中,
EndpointName()
是NServiceBus在
NServiceBus
命名空间中提供的扩展方法。

您可以使用一个
ReadOnlySetting
实例,查看以下示例:

class MyClass : IWantToRunWhenBusStartsAndStops
{
    public ReadOnlySettings Settings{ get; set; }

    public void Start()
    {
        var name = this.Settings.EndpointName();
    }

    public void Stop()
    {

    }
}
其中,
EndpointName()
是NServiceBus在
NServiceBus
命名空间中提供的扩展方法