本文整理汇总了C#中BindingElementCollection.Find方法的典型用法代码示例。如果您正苦于以下问题:C# BindingElementCollection.Find方法的具体用法?C# BindingElementCollection.Find怎么用?C# BindingElementCollection.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingElementCollection
的用法示例。
在下文中一共展示了BindingElementCollection.Find方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindingRequiresAuthentication
static bool BindingRequiresAuthentication(BindingElementCollection elements)
{
SecurityBindingElement element = elements.Find<SecurityBindingElement>();
if (element != null)
{
foreach (SecurityTokenParameters parameters in EnumerateNestedTokenParameters(element))
{
if (parameters is SspiSecurityTokenParameters)
return true;
}
}
return false;
}
示例2: Extend
public BindingElementCollection Extend(BindingElementCollection bindingElementCollection)
{
MessageEncodingBindingElement item = bindingElementCollection.Find<MessageEncodingBindingElement>();
if (item != null)
{
ConfigureFromMessageEncodingBindingElement(item);
int index = bindingElementCollection.IndexOf(item);
bindingElementCollection.RemoveAt(index);
bindingElementCollection.Insert(index, this);
return bindingElementCollection;
}
bindingElementCollection.Insert(0, this);
return bindingElementCollection;
}
示例3: TryCreate
internal static bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
{
if (bindingElements == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
}
binding = null;
ContextBindingElement element = bindingElements.Find<ContextBindingElement>();
if ((element != null) && (element.ContextExchangeMechanism != ContextExchangeMechanism.HttpCookie))
{
Binding binding2;
BindingElementCollection elements = new BindingElementCollection(bindingElements);
elements.Remove<ContextBindingElement>();
if (NetTcpBinding.TryCreate(elements, out binding2))
{
NetTcpContextBinding binding3 = new NetTcpContextBinding((NetTcpBinding) binding2) {
ContextProtectionLevel = element.ProtectionLevel,
ContextManagementEnabled = element.ContextManagementEnabled
};
binding = binding3;
}
}
return (binding != null);
}
示例4: UsesTransactionFlowProperties
static bool UsesTransactionFlowProperties(BindingElementCollection bindingElements, ContractDescription contract)
{
BindingElementCollection bindingElementCollection = new BindingElementCollection(bindingElements);
TransactionFlowBindingElement txBE = bindingElementCollection.Find<TransactionFlowBindingElement>();
if (txBE == null)
{
return false;
}
return txBE.IsFlowEnabled(contract);
}
示例5: EndpointAllowsTransactionFlow
static bool EndpointAllowsTransactionFlow(ServiceEndpoint endpoint, BindingElementCollection elements)
{
TransactionFlowBindingElement flow = elements.Find<TransactionFlowBindingElement>();
return flow != null && ContractAllowsTransactionFlow(endpoint.Contract);
}
示例6: TryCreate
internal static new bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
{
if (bindingElements == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
}
binding = null;
ContextBindingElement contextBindingElement = bindingElements.Find<ContextBindingElement>();
if (contextBindingElement != null)
{
BindingElementCollection bindingElementsWithoutContext = new BindingElementCollection(bindingElements);
bindingElementsWithoutContext.Remove<ContextBindingElement>();
Binding wsHttpBinding;
if (WSHttpBinding.TryCreate(bindingElementsWithoutContext, out wsHttpBinding))
{
bool allowCookies = ((WSHttpBinding)wsHttpBinding).AllowCookies;
if (allowCookies && contextBindingElement.ContextExchangeMechanism == ContextExchangeMechanism.HttpCookie
|| !allowCookies && contextBindingElement.ContextExchangeMechanism == ContextExchangeMechanism.ContextSoapHeader)
{
WSHttpContextBinding contextBinding = new WSHttpContextBinding((WSHttpBinding)wsHttpBinding);
contextBinding.ContextProtectionLevel = contextBindingElement.ProtectionLevel;
contextBinding.ContextManagementEnabled = contextBindingElement.ContextManagementEnabled;
binding = contextBinding;
}
}
}
return binding != null;
}
示例7: TryCreate
internal static bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
{
if (bindingElements == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
}
binding = null;
ContextBindingElement element = bindingElements.Find<ContextBindingElement>();
if (element != null)
{
Binding binding2;
BindingElementCollection elements = new BindingElementCollection(bindingElements);
elements.Remove<ContextBindingElement>();
if (WSHttpBindingBase.TryCreate(elements, out binding2))
{
bool allowCookies = ((WSHttpBinding) binding2).AllowCookies;
if ((allowCookies && (element.ContextExchangeMechanism == ContextExchangeMechanism.HttpCookie)) || (!allowCookies && (element.ContextExchangeMechanism == ContextExchangeMechanism.ContextSoapHeader)))
{
WSHttpContextBinding binding3 = new WSHttpContextBinding((WSHttpBinding) binding2) {
ContextProtectionLevel = element.ProtectionLevel,
ContextManagementEnabled = element.ContextManagementEnabled
};
binding = binding3;
}
}
}
return (binding != null);
}
示例8: TryCreate
internal static new bool TryCreate(BindingElementCollection bindingElements, out Binding binding)
{
if (bindingElements == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElements");
}
binding = null;
ContextBindingElement contextBindingElement = bindingElements.Find<ContextBindingElement>();
if (contextBindingElement != null && contextBindingElement.ContextExchangeMechanism != ContextExchangeMechanism.HttpCookie)
{
BindingElementCollection bindingElementsWithoutContext = new BindingElementCollection(bindingElements);
bindingElementsWithoutContext.Remove<ContextBindingElement>();
Binding netTcpBinding;
if (NetTcpBinding.TryCreate(bindingElementsWithoutContext, out netTcpBinding))
{
NetTcpContextBinding contextBinding = new NetTcpContextBinding((NetTcpBinding)netTcpBinding);
contextBinding.ContextProtectionLevel = contextBindingElement.ProtectionLevel;
contextBinding.ContextManagementEnabled = contextBindingElement.ContextManagementEnabled;
binding = contextBinding;
}
}
return binding != null;
}