Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / DynamicEndpoint.cs / 1305376 / DynamicEndpoint.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.ServiceModel.Discovery
{
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Runtime;
using System.Xml;
[Fx.Tag.XamlVisible(false)]
public class DynamicEndpoint : ServiceEndpoint
{
DiscoveryClientBindingElement discoveryClientBindingElement;
internal DynamicEndpoint(ContractDescription contract)
: base(contract, null, DiscoveryClientBindingElement.DiscoveryEndpointAddress)
{
this.discoveryClientBindingElement = new DiscoveryClientBindingElement();
}
public DynamicEndpoint(ContractDescription contract, Binding binding)
: base(contract, binding, DiscoveryClientBindingElement.DiscoveryEndpointAddress)
{
if (binding == null)
{
throw FxTrace.Exception.ArgumentNull("binding");
}
this.discoveryClientBindingElement = new DiscoveryClientBindingElement();
if (this.ValidateAndInsertDiscoveryClientBindingElement(binding))
{
this.FindCriteria.ContractTypeNames.Add(
new XmlQualifiedName(contract.Name, contract.Namespace));
}
else
{
throw FxTrace.Exception.Argument(
"binding",
SR.DiscoveryClientBindingElementPresentInDynamicEndpoint);
}
}
public DiscoveryEndpointProvider DiscoveryEndpointProvider
{
get
{
return this.discoveryClientBindingElement.DiscoveryEndpointProvider;
}
set
{
if (value == null)
{
throw FxTrace.Exception.ArgumentNull("value");
}
this.discoveryClientBindingElement.DiscoveryEndpointProvider = value;
}
}
public FindCriteria FindCriteria
{
get
{
return this.discoveryClientBindingElement.FindCriteria;
}
set
{
if (value == null)
{
throw FxTrace.Exception.ArgumentNull("value");
}
this.discoveryClientBindingElement.FindCriteria = value;
}
}
internal bool ValidateAndInsertDiscoveryClientBindingElement(Binding binding)
{
CustomBinding customBinding = new CustomBinding(binding);
if (customBinding.Elements.Find() == null)
{
customBinding.Elements.Insert(0, this.discoveryClientBindingElement);
this.Binding = customBinding;
return true;
}
else
{
return false;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NameValueConfigurationCollection.cs
- ListControl.cs
- ToolboxComponentsCreatedEventArgs.cs
- DocumentSchemaValidator.cs
- DataServiceRequest.cs
- Function.cs
- ProfileProvider.cs
- FontInfo.cs
- SystemIPv4InterfaceProperties.cs
- ByteAnimationUsingKeyFrames.cs
- SqlXml.cs
- NumberFormatInfo.cs
- assemblycache.cs
- ThreadAttributes.cs
- metadatamappinghashervisitor.cs
- StretchValidation.cs
- AccessViolationException.cs
- DoubleCollection.cs
- ForceCopyBuildProvider.cs
- RIPEMD160.cs
- NamespaceTable.cs
- VideoDrawing.cs
- CalculatedColumn.cs
- DataListGeneralPage.cs
- EndOfStreamException.cs
- AttributeCollection.cs
- DrawListViewItemEventArgs.cs
- FollowerQueueCreator.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- LinqToSqlWrapper.cs
- LicenseException.cs
- Crc32.cs
- DependencyPropertyChangedEventArgs.cs
- DataBindingCollectionEditor.cs
- Expressions.cs
- List.cs
- DataServiceQueryException.cs
- WorkflowCommandExtensionItem.cs
- QilDataSource.cs
- TagPrefixInfo.cs
- WinCategoryAttribute.cs
- XmlSchemaImporter.cs
- NavigationWindow.cs
- SystemInfo.cs
- WebPartMinimizeVerb.cs
- CompiledAction.cs
- EmptyImpersonationContext.cs
- ClonableStack.cs
- FormatSettings.cs
- PermissionSetTriple.cs
- OleServicesContext.cs
- StorageComplexTypeMapping.cs
- ReflectEventDescriptor.cs
- EntityDataSourceWizardForm.cs
- QueryStringParameter.cs
- ReferenceConverter.cs
- DbConnectionPoolGroup.cs
- ProcessInputEventArgs.cs
- CheckBox.cs
- DbReferenceCollection.cs
- SecurityDescriptor.cs
- CoreSwitches.cs
- ClientUtils.cs
- CodeThrowExceptionStatement.cs
- SqlDataRecord.cs
- DataObjectAttribute.cs
- DbConnectionOptions.cs
- ListControl.cs
- FileEnumerator.cs
- AnimationStorage.cs
- JsonReaderWriterFactory.cs
- GlyphElement.cs
- Logging.cs
- ReadOnlyMetadataCollection.cs
- Pkcs7Recipient.cs
- DependencyObjectValidator.cs
- XmlSerializerSection.cs
- Typography.cs
- BufferBuilder.cs
- WindowsAuthenticationEventArgs.cs
- OrthographicCamera.cs
- XmlSignatureManifest.cs
- DeriveBytes.cs
- Model3DGroup.cs
- baseaxisquery.cs
- TextOnlyOutput.cs
- XamlDebuggerXmlReader.cs
- DesigntimeLicenseContext.cs
- Timer.cs
- WebPartVerbCollection.cs
- DetailsViewUpdatedEventArgs.cs
- HtmlCommandAdapter.cs
- TimersDescriptionAttribute.cs
- XomlCompilerParameters.cs
- TreeWalker.cs
- PeerTransportBindingElement.cs
- ReliabilityContractAttribute.cs
- LinkLabel.cs
- TrackingStringDictionary.cs
- Hyperlink.cs