本文整理汇总了C#中BindingElement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# BindingElement.GetType方法的具体用法?C# BindingElement.GetType怎么用?C# BindingElement.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingElement
的用法示例。
在下文中一共展示了BindingElement.GetType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryCreateMatchingExtension
bool TryCreateMatchingExtension(BindingElement bindingElement, ExtensionElementCollection collection, bool allowDerivedTypes, string assemblyName, out BindingElementExtensionElement result)
{
result = null;
foreach (ExtensionElement element in collection)
{
BindingElementExtensionElement bindingElementExtension = Activator.CreateInstance(Type.GetType(element.Type, true)) as BindingElementExtensionElement;
if (null == bindingElementExtension)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigInvalidExtensionType,
element.Type,
assemblyName,
ConfigurationStrings.BindingElementExtensions)));
}
bool isMatch;
if (allowDerivedTypes)
{
isMatch = bindingElementExtension.BindingElementType.IsAssignableFrom(bindingElement.GetType());
}
else
{
isMatch = bindingElementExtension.BindingElementType.Equals(bindingElement.GetType());
}
if (isMatch)
{
result = bindingElementExtension;
return true;
}
}
return false;
}
示例2: InitializeFrom
protected internal virtual void InitializeFrom(BindingElement bindingElement)
{
if (bindingElement == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement");
}
if (bindingElement.GetType() != this.BindingElementType)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("ConfigInvalidTypeForBindingElement", new object[] { this.BindingElementType.ToString(), bindingElement.GetType().ToString() }));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:BindingElementExtensionElement.cs
示例3: TryCreateMatchingExtension
private bool TryCreateMatchingExtension(BindingElement bindingElement, ExtensionElementCollection collection, bool allowDerivedTypes, string assemblyName, out BindingElementExtensionElement result)
{
result = null;
foreach (ExtensionElement element in collection)
{
bool flag;
BindingElementExtensionElement element2 = Activator.CreateInstance(System.Type.GetType(element.Type, true)) as BindingElementExtensionElement;
if (element2 == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidExtensionType", new object[] { element.Type, assemblyName, "bindingElementExtensions" })));
}
if (allowDerivedTypes)
{
flag = element2.BindingElementType.IsAssignableFrom(bindingElement.GetType());
}
else
{
flag = element2.BindingElementType.Equals(bindingElement.GetType());
}
if (flag)
{
result = element2;
return true;
}
}
return false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:CustomBindingCollectionElement.cs
示例4: ApplyConfiguration
public override void ApplyConfiguration(BindingElement bindingElement)
{
base.ApplyConfiguration(bindingElement);
if (bindingElement == null)
throw new ArgumentNullException("bindingElement");
var bindind = bindingElement as QpidTransportBindingElement;
if (bindind == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(QpidTransportBindingElement).AssemblyQualifiedName,
bindingElement.GetType().AssemblyQualifiedName));
}
bindind.Host = Host;
bindind.Password = Password;
bindind.UserName = UserName;
bindind.VirtualHost = VirtualHost;
bindind.PortNumber = PortNumber;
}
示例5: ApplyConfiguration
public override void ApplyConfiguration(BindingElement bindingElement)
{
base.ApplyConfiguration(bindingElement);
if (bindingElement == null)
throw new ArgumentNullException("binding");
RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;
if (rabbind == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(RabbitMQBinding).AssemblyQualifiedName,
bindingElement.GetType().AssemblyQualifiedName));
}
rabbind.HostName = this.HostName;
rabbind.Port = this.Port;
rabbind.BrokerProtocol = this.Protocol;
rabbind.ConnectionFactory.Password = this.Password;
rabbind.ConnectionFactory.UserName = this.Username;
rabbind.ConnectionFactory.VirtualHost = this.VirtualHost;
}
示例6: FillBindingInfo
private static void FillBindingInfo(BindingElement bindingElement, ref IWmiInstance instance)
{
if (bindingElement is IWmiInstanceProvider)
{
IWmiInstanceProvider provider = (IWmiInstanceProvider) bindingElement;
instance = instance.NewInstance(provider.GetInstanceType());
provider.FillInstance(instance);
}
else
{
System.Type serviceModelBaseType = AdministrationHelpers.GetServiceModelBaseType(bindingElement.GetType());
if (null != serviceModelBaseType)
{
instance = instance.NewInstance(serviceModelBaseType.Name);
if (bindingElement is TransportBindingElement)
{
TransportBindingElement element = (TransportBindingElement) bindingElement;
instance.SetProperty("ManualAddressing", element.ManualAddressing);
instance.SetProperty("MaxReceivedMessageSize", element.MaxReceivedMessageSize);
instance.SetProperty("MaxBufferPoolSize", element.MaxBufferPoolSize);
instance.SetProperty("Scheme", element.Scheme);
if (bindingElement is ConnectionOrientedTransportBindingElement)
{
ConnectionOrientedTransportBindingElement element2 = (ConnectionOrientedTransportBindingElement) bindingElement;
instance.SetProperty("ConnectionBufferSize", element2.ConnectionBufferSize);
instance.SetProperty("HostNameComparisonMode", element2.HostNameComparisonMode.ToString());
instance.SetProperty("ChannelInitializationTimeout", element2.ChannelInitializationTimeout);
instance.SetProperty("MaxBufferSize", element2.MaxBufferSize);
instance.SetProperty("MaxPendingConnections", element2.MaxPendingConnections);
instance.SetProperty("MaxOutputDelay", element2.MaxOutputDelay);
instance.SetProperty("MaxPendingAccepts", element2.MaxPendingAccepts);
instance.SetProperty("TransferMode", element2.TransferMode.ToString());
if (bindingElement is TcpTransportBindingElement)
{
TcpTransportBindingElement element3 = (TcpTransportBindingElement) bindingElement;
instance.SetProperty("ListenBacklog", element3.ListenBacklog);
instance.SetProperty("PortSharingEnabled", element3.PortSharingEnabled);
instance.SetProperty("TeredoEnabled", element3.TeredoEnabled);
IWmiInstance instance2 = instance.NewInstance("TcpConnectionPoolSettings");
instance2.SetProperty("GroupName", element3.ConnectionPoolSettings.GroupName);
instance2.SetProperty("IdleTimeout", element3.ConnectionPoolSettings.IdleTimeout);
instance2.SetProperty("LeaseTimeout", element3.ConnectionPoolSettings.LeaseTimeout);
instance2.SetProperty("MaxOutboundConnectionsPerEndpoint", element3.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
instance.SetProperty("ConnectionPoolSettings", instance2);
FillExtendedProtectionPolicy(instance, element3.ExtendedProtectionPolicy);
}
else if (bindingElement is NamedPipeTransportBindingElement)
{
NamedPipeTransportBindingElement element4 = (NamedPipeTransportBindingElement) bindingElement;
IWmiInstance instance3 = instance.NewInstance("NamedPipeConnectionPoolSettings");
instance3.SetProperty("GroupName", element4.ConnectionPoolSettings.GroupName);
instance3.SetProperty("IdleTimeout", element4.ConnectionPoolSettings.IdleTimeout);
instance3.SetProperty("MaxOutboundConnectionsPerEndpoint", element4.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
instance.SetProperty("ConnectionPoolSettings", instance3);
}
}
else if (!(bindingElement is HttpTransportBindingElement))
{
if (!(bindingElement is MsmqBindingElementBase))
{
if (bindingElement is PeerTransportBindingElement)
{
PeerTransportBindingElement element9 = (PeerTransportBindingElement) bindingElement;
instance.SetProperty("ListenIPAddress", element9.ListenIPAddress);
instance.SetProperty("Port", element9.Port);
IWmiInstance instance4 = instance.NewInstance("PeerSecuritySettings");
instance4.SetProperty("Mode", element9.Security.Mode.ToString());
IWmiInstance instance5 = instance4.NewInstance("PeerTransportSecuritySettings");
instance5.SetProperty("CredentialType", element9.Security.Transport.CredentialType.ToString());
instance4.SetProperty("Transport", instance5);
instance.SetProperty("Security", instance4);
}
}
else
{
MsmqBindingElementBase base2 = (MsmqBindingElementBase) bindingElement;
if (null != base2.CustomDeadLetterQueue)
{
instance.SetProperty("CustomDeadLetterQueue", base2.CustomDeadLetterQueue.AbsoluteUri.ToString());
}
instance.SetProperty("DeadLetterQueue", base2.DeadLetterQueue);
instance.SetProperty("Durable", base2.Durable);
instance.SetProperty("ExactlyOnce", base2.ExactlyOnce);
instance.SetProperty("MaxRetryCycles", base2.MaxRetryCycles);
instance.SetProperty("ReceiveContextEnabled", base2.ReceiveContextEnabled);
instance.SetProperty("ReceiveErrorHandling", base2.ReceiveErrorHandling);
instance.SetProperty("ReceiveRetryCount", base2.ReceiveRetryCount);
instance.SetProperty("RetryCycleDelay", base2.RetryCycleDelay);
instance.SetProperty("TimeToLive", base2.TimeToLive);
instance.SetProperty("UseSourceJournal", base2.UseSourceJournal);
instance.SetProperty("UseMsmqTracing", base2.UseMsmqTracing);
instance.SetProperty("ValidityDuration", base2.ValidityDuration);
MsmqTransportBindingElement element7 = base2 as MsmqTransportBindingElement;
if (element7 != null)
{
instance.SetProperty("MaxPoolSize", element7.MaxPoolSize);
instance.SetProperty("QueueTransferProtocol", element7.QueueTransferProtocol);
instance.SetProperty("UseActiveDirectory", element7.UseActiveDirectory);
}
MsmqIntegrationBindingElement element8 = base2 as MsmqIntegrationBindingElement;
//.........这里部分代码省略.........
示例7: InitializeFrom
protected override void InitializeFrom(BindingElement bindingElement)
{
base.InitializeFrom(bindingElement);
if (bindingElement == null)
throw new ArgumentNullException("binding");
RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;
if (rabbind == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(RabbitMQBinding).AssemblyQualifiedName,
bindingElement.GetType().AssemblyQualifiedName));
}
this.PersistentDelivery = rabbind.PersistentDelivery;
this.AutoBindExchange = rabbind.AutoBindExchange;
this.TTL = rabbind.TTL;
this.ProtocolVersion = rabbind.BrokerProtocol.ApiName;
this.ReplyToQueue = rabbind.ReplyToQueue;
this.ReplyToExchange = rabbind.ReplyToExchange.ToString();
this.OneWayOnly = rabbind.OneWayOnly;
}
示例8: ApplyConfiguration
public override void ApplyConfiguration(BindingElement bindingElement)
{
base.ApplyConfiguration(bindingElement);
if (bindingElement == null)
throw new ArgumentNullException("binding");
RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;
if (rabbind == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(RabbitMQBinding).AssemblyQualifiedName,
bindingElement.GetType().AssemblyQualifiedName));
}
rabbind.PersistentDelivery = this.PersistentDelivery;
rabbind.AutoBindExchange = this.AutoBindExchange;
rabbind.TTL = this.TTL;
rabbind.BrokerProtocol = this.Protocol;
rabbind.TransactedReceiveEnabled = this.ExactlyOnce;
rabbind.ReplyToQueue = this.ReplyToQueue;
rabbind.ReplyToExchange = this.ReplyToExchange != null ? new Uri(this.ReplyToExchange) : null;
rabbind.OneWayOnly = this.OneWayOnly;
}
示例9: FillBindingInfo
static void FillBindingInfo(BindingElement bindingElement, ref IWmiInstance instance)
{
Fx.Assert(null != bindingElement, "");
Fx.Assert(null != instance, "");
if (bindingElement is IWmiInstanceProvider)
{
IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)bindingElement;
instance = instance.NewInstance(instanceProvider.GetInstanceType());
instanceProvider.FillInstance(instance);
return;
}
Type elementType = AdministrationHelpers.GetServiceModelBaseType(bindingElement.GetType());
if (null != elementType)
{
instance = instance.NewInstance(elementType.Name);
if (bindingElement is TransportBindingElement)
{
TransportBindingElement transport = (TransportBindingElement)bindingElement;
instance.SetProperty(AdministrationStrings.ManualAddressing, transport.ManualAddressing);
instance.SetProperty(AdministrationStrings.MaxReceivedMessageSize, transport.MaxReceivedMessageSize);
instance.SetProperty(AdministrationStrings.MaxBufferPoolSize, transport.MaxBufferPoolSize);
instance.SetProperty(AdministrationStrings.Scheme, transport.Scheme);
if (bindingElement is ConnectionOrientedTransportBindingElement)
{
ConnectionOrientedTransportBindingElement connectionOriented = (ConnectionOrientedTransportBindingElement)bindingElement;
instance.SetProperty(AdministrationStrings.ConnectionBufferSize, connectionOriented.ConnectionBufferSize);
instance.SetProperty(AdministrationStrings.HostNameComparisonMode, connectionOriented.HostNameComparisonMode.ToString());
instance.SetProperty(AdministrationStrings.ChannelInitializationTimeout, connectionOriented.ChannelInitializationTimeout);
instance.SetProperty(AdministrationStrings.MaxBufferSize, connectionOriented.MaxBufferSize);
instance.SetProperty(AdministrationStrings.MaxPendingConnections, connectionOriented.MaxPendingConnections);
instance.SetProperty(AdministrationStrings.MaxOutputDelay, connectionOriented.MaxOutputDelay);
instance.SetProperty(AdministrationStrings.MaxPendingAccepts, connectionOriented.MaxPendingAccepts);
instance.SetProperty(AdministrationStrings.TransferMode, connectionOriented.TransferMode.ToString());
if (bindingElement is TcpTransportBindingElement)
{
TcpTransportBindingElement tcp = (TcpTransportBindingElement)bindingElement;
instance.SetProperty(AdministrationStrings.ListenBacklog, tcp.ListenBacklog);
instance.SetProperty(AdministrationStrings.PortSharingEnabled, tcp.PortSharingEnabled);
instance.SetProperty(AdministrationStrings.TeredoEnabled, tcp.TeredoEnabled);
IWmiInstance connectionPool = instance.NewInstance(AdministrationStrings.TcpConnectionPoolSettings);
connectionPool.SetProperty(AdministrationStrings.GroupName, tcp.ConnectionPoolSettings.GroupName);
connectionPool.SetProperty(AdministrationStrings.IdleTimeout, tcp.ConnectionPoolSettings.IdleTimeout);
connectionPool.SetProperty(AdministrationStrings.LeaseTimeout, tcp.ConnectionPoolSettings.LeaseTimeout);
connectionPool.SetProperty(AdministrationStrings.MaxOutboundConnectionsPerEndpoint, tcp.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
instance.SetProperty(AdministrationStrings.ConnectionPoolSettings, connectionPool);
FillExtendedProtectionPolicy(instance, tcp.ExtendedProtectionPolicy);
}
else if (bindingElement is NamedPipeTransportBindingElement)
{
NamedPipeTransportBindingElement namedPipe = (NamedPipeTransportBindingElement)bindingElement;
IWmiInstance connectionPool = instance.NewInstance(AdministrationStrings.NamedPipeConnectionPoolSettings);
connectionPool.SetProperty(AdministrationStrings.GroupName, namedPipe.ConnectionPoolSettings.GroupName);
connectionPool.SetProperty(AdministrationStrings.IdleTimeout, namedPipe.ConnectionPoolSettings.IdleTimeout);
connectionPool.SetProperty(AdministrationStrings.MaxOutboundConnectionsPerEndpoint, namedPipe.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
instance.SetProperty(AdministrationStrings.ConnectionPoolSettings, connectionPool);
}
}
else if (bindingElement is HttpTransportBindingElement)
{
HttpTransportBindingElement http = (HttpTransportBindingElement)bindingElement;
instance.SetProperty(AdministrationStrings.AllowCookies, http.AllowCookies);
instance.SetProperty(AdministrationStrings.AuthenticationScheme, http.AuthenticationScheme.ToString());
instance.SetProperty(AdministrationStrings.BypassProxyOnLocal, http.BypassProxyOnLocal);
instance.SetProperty(AdministrationStrings.DecompressionEnabled, http.DecompressionEnabled);
instance.SetProperty(AdministrationStrings.HostNameComparisonMode, http.HostNameComparisonMode.ToString());
instance.SetProperty(AdministrationStrings.KeepAliveEnabled, http.KeepAliveEnabled);
instance.SetProperty(AdministrationStrings.MaxBufferSize, http.MaxBufferSize);
if (null != http.ProxyAddress)
{
instance.SetProperty(AdministrationStrings.ProxyAddress, http.ProxyAddress.AbsoluteUri.ToString());
}
instance.SetProperty(AdministrationStrings.ProxyAuthenticationScheme, http.ProxyAuthenticationScheme.ToString());
instance.SetProperty(AdministrationStrings.Realm, http.Realm);
instance.SetProperty(AdministrationStrings.TransferMode, http.TransferMode.ToString());
instance.SetProperty(AdministrationStrings.UnsafeConnectionNtlmAuthentication, http.UnsafeConnectionNtlmAuthentication);
instance.SetProperty(AdministrationStrings.UseDefaultWebProxy, http.UseDefaultWebProxy);
FillExtendedProtectionPolicy(instance, http.ExtendedProtectionPolicy);
if (bindingElement is HttpsTransportBindingElement)
{
HttpsTransportBindingElement https = (HttpsTransportBindingElement)bindingElement;
instance.SetProperty(AdministrationStrings.RequireClientCertificate, https.RequireClientCertificate);
}
}
else if (bindingElement is MsmqBindingElementBase)
{
MsmqBindingElementBase msmq = (MsmqBindingElementBase)bindingElement;
if (null != msmq.CustomDeadLetterQueue)
//.........这里部分代码省略.........
示例10: InitializeFrom
protected override void InitializeFrom(BindingElement bindingElement)
{
base.InitializeFrom(bindingElement);
if (bindingElement == null)
throw new ArgumentNullException("bindingElement");
var binding = bindingElement as QpidTransportBindingElement;
if (binding == null)
{
throw new ArgumentException(
string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
typeof(QpidTransportBindingElement).AssemblyQualifiedName,
bindingElement.GetType().AssemblyQualifiedName));
}
Host = binding.Host;
PortNumber = binding.PortNumber;
Password = binding.Password;
UserName = binding.UserName;
VirtualHost = binding.VirtualHost;
}