ChannelDispatcher.ChannelInitializers Vlastnost

Definice

Získá sadu IChannelInitializer objektů, které můžete použít ke kontrole a přidání stavu do kanálů při jejich prvním vytvoření.

public:
 property System::Collections::Generic::SynchronizedCollection<System::ServiceModel::Dispatcher::IChannelInitializer ^> ^ ChannelInitializers { System::Collections::Generic::SynchronizedCollection<System::ServiceModel::Dispatcher::IChannelInitializer ^> ^ get(); };
public System.Collections.Generic.SynchronizedCollection<System.ServiceModel.Dispatcher.IChannelInitializer> ChannelInitializers { get; }
member this.ChannelInitializers : System.Collections.Generic.SynchronizedCollection<System.ServiceModel.Dispatcher.IChannelInitializer>
Public ReadOnly Property ChannelInitializers As SynchronizedCollection(Of IChannelInitializer)

Hodnota vlastnosti

SynchronizedCollection<IChannelInitializer>

Objekty SynchronizedCollection<T> typu IChannelInitializer .

Příklady

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

serviceHost.Open();

ChannelDispatcher dispatcher = (ChannelDispatcher) serviceHost.ChannelDispatchers[0];
SynchronizedCollection<IChannelInitializer> col = dispatcher.ChannelInitializers;
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

serviceHost.Open()

Dim dispatcher As ChannelDispatcher = CType(serviceHost.ChannelDispatchers(0), ChannelDispatcher)
Dim col As SynchronizedCollection(Of IChannelInitializer) = dispatcher.ChannelInitializers

Poznámky

Tato vlastnost slouží k vložení vlastního inicializátoru kanálu do inicializační kolekce pro kontrolu nebo úpravu stavu kanálu při jejich vytvoření. To je také užitečné provést stejné chování u odchozích kanálů, pokud je kontrakt přidružený k dispečeru duplexní kontrakt.

Platí pro