本文整理汇总了C#中System.ServiceModel.Channels.Binding.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Binding.GetType方法的具体用法?C# Binding.GetType怎么用?C# Binding.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Channels.Binding
的用法示例。
在下文中一共展示了Binding.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if (binding == null)
throw new ArgumentNullException("binding");
if (binding.GetType() != typeof(NetUdpBinding))
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
"Invalid type for binding. Expected type: {0}. Type passed in: {1}.",
typeof(NetUdpBinding).AssemblyQualifiedName,
binding.GetType().AssemblyQualifiedName));
}
}
示例2: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if (binding == null)
throw new ArgumentNullException("binding");
if (binding.GetType() != typeof(AmqpBinaryBinding))
{
throw new ArgumentException(string.Format("Invalid type for configuring an AMQP binding. Expected type: {0}. Type passed in: {1}.",
typeof(AmqpBinaryBinding).AssemblyQualifiedName,
binding.GetType().AssemblyQualifiedName));
}
base.OnApplyConfiguration(binding);
}
示例3: InitializeFrom
protected internal virtual void InitializeFrom(Binding binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
if (binding.GetType() != this.BindingElementType)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ConfigInvalidTypeForBinding", new object[] { (this.BindingElementType == null) ? string.Empty : this.BindingElementType.AssemblyQualifiedName, binding.GetType().AssemblyQualifiedName }));
}
this.CloseTimeout = binding.CloseTimeout;
this.OpenTimeout = binding.OpenTimeout;
this.ReceiveTimeout = binding.ReceiveTimeout;
this.SendTimeout = binding.SendTimeout;
}
示例4: ApplyConfiguration
public void ApplyConfiguration(Binding binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
if (binding.GetType() != this.BindingElementType)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(System.ServiceModel.SR.GetString("ConfigInvalidTypeForBinding", new object[] { (this.BindingElementType == null) ? string.Empty : this.BindingElementType.AssemblyQualifiedName, binding.GetType().AssemblyQualifiedName }));
}
binding.CloseTimeout = this.CloseTimeout;
binding.OpenTimeout = this.OpenTimeout;
binding.ReceiveTimeout = this.ReceiveTimeout;
binding.SendTimeout = this.SendTimeout;
this.OnApplyConfiguration(binding);
}
示例5: Trace
public static void Trace(TraceEventType type, int v, string description, System.Type contractType, Binding binding)
{
if (DiagnosticUtility.ShouldTrace(type))
{
ComPlusTypedChannelBuilderSchema schema = new ComPlusTypedChannelBuilderSchema(contractType.ToString(), (binding != null) ? binding.GetType().ToString() : null);
TraceUtility.TraceEvent(type, v, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ComPlusTypedChannelBuilderTrace.cs
示例6: ConfigureBinding
internal static void ConfigureBinding(Binding binding,bool anonymous)
{
if(binding is NetTcpRelayBinding)
{
NetTcpRelayBinding tcpBinding = (NetTcpRelayBinding)binding;
tcpBinding.Security.Mode = EndToEndSecurityMode.Message;
if(anonymous)
{
tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
}
else
{
tcpBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
}
tcpBinding.ConnectionMode = TcpRelayConnectionMode.Hybrid;
tcpBinding.ReliableSession.Enabled = true;
return;
}
if(binding is WSHttpRelayBinding)
{
WSHttpRelayBinding wsBinding = (WSHttpRelayBinding)binding;
wsBinding.Security.Mode = EndToEndSecurityMode.Message;
if(anonymous)
{
wsBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
}
else
{
wsBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
}
wsBinding.ReliableSession.Enabled = true;
return;
}
if(binding is NetOnewayRelayBinding)
{
NetOnewayRelayBinding onewayBinding = (NetOnewayRelayBinding)binding;
onewayBinding.Security.Mode = EndToEndSecurityMode.Message;
if(anonymous)
{
onewayBinding.Security.Message.ClientCredentialType = MessageCredentialType.None;
}
else
{
onewayBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
}
return;
}
throw new InvalidOperationException(binding.GetType() + " is unsupported");
}
示例7: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if (binding == null)
throw new ArgumentNullException("binding");
if (binding.GetType() != typeof(SampleProfileUdpBinding))
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
"Invalid type for binding. Expected type: {0}. Type passed in: {1}.",
typeof(SampleProfileUdpBinding).AssemblyQualifiedName,
binding.GetType().AssemblyQualifiedName));
}
SampleProfileUdpBinding udpBinding = (SampleProfileUdpBinding)binding;
udpBinding.OrderedSession = this.OrderedSession;
udpBinding.ReliableSessionEnabled = this.ReliableSessionEnabled;
udpBinding.SessionInactivityTimeout = this.SessionInactivityTimeout;
}
示例8: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if (binding == null)
throw new ArgumentNullException("binding");
var qpidbinding = binding as QpidBinding;
if (qpidbinding == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(QpidBinding).AssemblyQualifiedName,
binding.GetType().AssemblyQualifiedName));
}
qpidbinding.Host = Host;
qpidbinding.OneWayOnly = OneWayOnly;
qpidbinding.TransactionFlow = TransactionFlowEnabled;
qpidbinding.Password = Password;
qpidbinding.UserName = UserName;
qpidbinding.VirtualHost = VirtualHost;
qpidbinding.PortNumber = PortNumber;
}
示例9: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if (null == binding)
{
throw new ArgumentNullException("binding");
}
if (binding.GetType() != typeof(WSStreamedHttpBinding))
{
throw new ArgumentException();
}
WSStreamedHttpBinding wssBinding = (WSStreamedHttpBinding)binding;
wssBinding.HostNameComparisonMode = this.HostNameComparisonMode;
wssBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
wssBinding.MaxBufferSize = this.MaxBufferSize;
wssBinding.ProxyAddress = this.ProxyAddress;
wssBinding.BypassProxyOnLocal = this.BypassProxyOnLocal;
wssBinding.UseDefaultWebProxy = this.UseDefaultWebProxy;
wssBinding.TransferMode = this.TransferMode;
wssBinding.TextEncoding = this.TextEncoding;
wssBinding.FlowTransactions = this.FlowTransactions;
wssBinding.SecurityMode = this.SecurityMode;
}
示例10: TryAdd
protected internal override bool TryAdd (string name, Binding binding, SysConfig config)
{
if (!binding.GetType ().Equals (typeof (CustomBinding)))
return false;
var element = new CustomBindingElement ();
element.Name = name;
element.InitializeFrom (binding);
Bindings.Add (element);
return true;
}
示例11: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if (binding == null)
throw new ArgumentNullException("binding");
RabbitMQBinding rabbind = binding as RabbitMQBinding;
if (rabbind == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(RabbitMQBinding).AssemblyQualifiedName,
binding.GetType().AssemblyQualifiedName));
}
rabbind.HostName = this.HostName;
rabbind.Port = this.Port;
rabbind.BrokerProtocol = this.Protocol;
rabbind.OneWayOnly = this.OneWayOnly;
rabbind.TransactionFlow = this.TransactionFlowEnabled;
rabbind.Transport.Password = this.Password;
rabbind.Transport.Username = this.Username;
rabbind.Transport.VirtualHost = this.VirtualHost;
rabbind.Transport.MaxReceivedMessageSize = this.MaxMessageSize;
rabbind.QueueName = this.QueueName;
rabbind.Durable = this.Durable;
rabbind.AutoDelete = this.AutoDelete;
rabbind.Exclusive = this.Exclusive;
}
示例12: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding)
{
if ((binding == null))
{
throw new System.ArgumentNullException("binding");
}
if ((binding.GetType() != typeof(ByteStreamHttpBinding)))
{
throw new System.ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid type for binding. Expected type: {0}. Type passed in: {1}.", typeof(ByteStreamHttpBinding).AssemblyQualifiedName, binding.GetType().AssemblyQualifiedName));
}
ByteStreamHttpBinding ByteStreamHttpBinding = ((ByteStreamHttpBinding)(binding));
ByteStreamHttpBinding.HostNameComparisonMode = this.HostNameComparisonMode;
ByteStreamHttpBinding.MaxBufferSize = this.MaxBufferSize;
ByteStreamHttpBinding.MaxBufferPoolSize = this.MaxBufferPoolSize;
ByteStreamHttpBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
ByteStreamHttpBinding.TransferMode = this.TransferMode;
// Copy reader quotas over if set from config.
if (this.ReaderQuotas.MaxDepth != 0)
{
ByteStreamHttpBinding.ReaderQuotas.MaxDepth = this.ReaderQuotas.MaxDepth;
}
if (this.ReaderQuotas.MaxStringContentLength != 0)
{
ByteStreamHttpBinding.ReaderQuotas.MaxStringContentLength = this.ReaderQuotas.MaxStringContentLength;
}
if (this.ReaderQuotas.MaxArrayLength != 0)
{
ByteStreamHttpBinding.ReaderQuotas.MaxArrayLength = this.ReaderQuotas.MaxArrayLength;
}
if (this.ReaderQuotas.MaxBytesPerRead != 0)
{
ByteStreamHttpBinding.ReaderQuotas.MaxBytesPerRead = this.ReaderQuotas.MaxBytesPerRead;
}
if (this.ReaderQuotas.MaxNameTableCharCount != 0)
{
ByteStreamHttpBinding.ReaderQuotas.MaxNameTableCharCount = this.ReaderQuotas.MaxNameTableCharCount;
}
}
示例13: FindCollectionElement
public static BindingCollectionElement FindCollectionElement (Binding binding, SysConfig config)
{
var section = (BindingsSection) config.GetSection ("system.serviceModel/bindings");
foreach (var element in section.BindingCollections) {
if (binding.GetType ().Equals (element.BindingType))
return element;
}
return null;
}
示例14: OnApplyConfiguration
protected override void OnApplyConfiguration(Binding binding) {
if ((binding == null)) {
throw new System.ArgumentNullException("binding");
}
if ((binding.GetType() != typeof(NetHttpBinding))) {
throw new System.ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid type for binding. Expected type: {0}. Type passed in: {1}.", typeof(NetHttpBinding).AssemblyQualifiedName, binding.GetType().AssemblyQualifiedName));
}
NetHttpBinding netHttpBinding = ((NetHttpBinding)(binding));
netHttpBinding.BypassProxyOnLocal = this.BypassProxyOnLocal;
netHttpBinding.HostNameComparisonMode = this.HostNameComparisonMode;
netHttpBinding.MaxBufferSize = this.MaxBufferSize;
netHttpBinding.MaxBufferPoolSize = this.MaxBufferPoolSize;
netHttpBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
netHttpBinding.ProxyAddress = this.ProxyAddress;
netHttpBinding.SecurityMode = this.SecurityMode;
netHttpBinding.TransferMode = this.TransferMode;
netHttpBinding.UseDefaultWebProxy = this.UseDefaultWebProxy;
netHttpBinding.ReaderQuotas = this.ReaderQuotas;
}
示例15: ApplyConfiguration
public void ApplyConfiguration(Binding binding)
{
if (null == binding)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
if (binding.GetType() != this.BindingElementType)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ConfigInvalidTypeForBinding,
(this.BindingElementType == null) ? string.Empty : this.BindingElementType.AssemblyQualifiedName,
binding.GetType().AssemblyQualifiedName));
}
// The properties binding.Name and this.Name are actually two different things:
// - binding.Name corresponds to how the WSDL for this binding is surfaced,
// it is used in conjunction with binding.Namespace
// - this.Name is a token used as a key in the binding collection to identify
// a specific bucket of configuration settings.
// Thus, the Name property is skipped here.
binding.CloseTimeout = this.CloseTimeout;
binding.OpenTimeout = this.OpenTimeout;
binding.ReceiveTimeout = this.ReceiveTimeout;
binding.SendTimeout = this.SendTimeout;
this.OnApplyConfiguration(binding);
}