void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint) { BindingElementCollection elements = serviceEndpoint.Binding.CreateBindingElements(); bool flag = false; foreach (BindingElement element in elements) { ITransactedBindingElement element2 = element as ITransactedBindingElement; if ((element2 != null) && element2.TransactedReceiveEnabled) { flag = true; break; } } if (!flag) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SfxTransactedBindingNeeded"))); } }
void IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint) { BindingElementCollection bindingElements = serviceEndpoint.Binding.CreateBindingElements(); bool transactedElementFound = false; foreach (BindingElement bindingElement in bindingElements) { ITransactedBindingElement txElement = bindingElement as ITransactedBindingElement; if (null != txElement && txElement.TransactedReceiveEnabled) { transactedElementFound = true; break; } } if (!transactedElementFound) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SfxTransactedBindingNeeded))); } }
internal static bool IsTransactedReceive(Binding binding, BindingParameterCollection bindingParameters) { // New school ITransactedBindingElement transactedBindingElement = binding.GetProperty <ITransactedBindingElement>(bindingParameters); if (transactedBindingElement != null) { return(transactedBindingElement.TransactedReceiveEnabled); } // Old School foreach (BindingElement element in binding.CreateBindingElements()) { transactedBindingElement = element as ITransactedBindingElement; if (transactedBindingElement != null && transactedBindingElement.TransactedReceiveEnabled) { return(true); } } return(false); }