Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Administration / ServiceInfo.cs / 1 / ServiceInfo.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Administration { using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Runtime.Serialization; using System.Reflection; using System.ServiceModel; using System.ServiceModel.Description; using System.Text; using System.Collections.ObjectModel; sealed class ServiceInfo { KeyedByTypeCollectionbehaviors; EndpointInfoCollection endpoints; ServiceHostBase service; string serviceName; internal ServiceInfo(ServiceHostBase service) { this.service = service; this.behaviors = service.Description.Behaviors; this.serviceName = service.Description.Name; this.endpoints = new EndpointInfoCollection(service.Description.Endpoints, this.ServiceName); } public string ConfigurationName { get { return this.service.Description.ConfigurationName; } } public string DistinguishedName { get { return this.serviceName + "@" + this.FirstAddress; } } public string FirstAddress { get { DiagnosticUtility.DebugAssert(null != this.Service.BaseAddresses, ""); string address = ""; if (this.Service.BaseAddresses.Count > 0) { DiagnosticUtility.DebugAssert(null != this.Service.BaseAddresses[0], ""); address = this.Service.BaseAddresses[0].ToString(); } else if (this.Endpoints.Count > 0) { Uri addressUri = this.Endpoints[0].Address; if (null != addressUri) { address = addressUri.ToString(); } } return address; } } public string Name { get { return this.serviceName; } } public string Namespace { get { return this.service.Description.Namespace; } } public string ServiceName { get { return this.serviceName; } } public ServiceHostBase Service { get { return this.service; } } public KeyedByTypeCollection Behaviors { get { return this.behaviors; } } public CommunicationState State { get { return this.Service.State; } } public EndpointInfoCollection Endpoints { get { return this.endpoints; } } public string[] Metadata { get { string[] result = null; ServiceMetadataExtension metadataExtension = service.Extensions.Find (); if (null != metadataExtension) { Collection metadataStrings = new Collection (); try { foreach (MetadataSection section in metadataExtension.Metadata.MetadataSections) { using (StringWriter sw = new StringWriter(CultureInfo.InvariantCulture)) { if (section.Metadata is System.Web.Services.Description.ServiceDescription) { System.Web.Services.Description.ServiceDescription metadata = (System.Web.Services.Description.ServiceDescription)section.Metadata; metadata.Write(sw); metadataStrings.Add(sw.ToString()); } else if (section.Metadata is System.Xml.XmlElement) { System.Xml.XmlElement metadata = (System.Xml.XmlElement)section.Metadata; using (System.Xml.XmlWriter xmlWriter = System.Xml.XmlWriter.Create(sw)) { metadata.WriteTo(xmlWriter); metadataStrings.Add(sw.ToString()); } } else if (section.Metadata is System.Xml.Schema.XmlSchema) { System.Xml.Schema.XmlSchema metadata = (System.Xml.Schema.XmlSchema)section.Metadata; metadata.Write(sw); metadataStrings.Add(sw.ToString()); } else { metadataStrings.Add(section.Metadata.ToString()); } } } } catch (InvalidOperationException e) { metadataStrings.Add(e.ToString()); } result = new string[metadataStrings.Count]; metadataStrings.CopyTo(result, 0); } return result; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EntityDescriptor.cs
- TableHeaderCell.cs
- QueryContinueDragEvent.cs
- ToolStripContentPanelDesigner.cs
- RectAnimationUsingKeyFrames.cs
- LoaderAllocator.cs
- MenuItemStyle.cs
- SiteMapNodeItemEventArgs.cs
- OracleDataReader.cs
- DataRecordInfo.cs
- SqlEnums.cs
- PageSetupDialog.cs
- XhtmlConformanceSection.cs
- CustomWebEventKey.cs
- DataControlField.cs
- TrackingStringDictionary.cs
- DragEvent.cs
- FilterElement.cs
- HttpListener.cs
- PermissionToken.cs
- EntityDataSourceEntitySetNameItem.cs
- WorkflowOperationBehavior.cs
- DataTableNameHandler.cs
- FixedSOMLineRanges.cs
- OleDbRowUpdatingEvent.cs
- BStrWrapper.cs
- Permission.cs
- DATA_BLOB.cs
- PersonalizationEntry.cs
- KeyGestureConverter.cs
- HttpSessionStateBase.cs
- SessionConnectionReader.cs
- MSAANativeProvider.cs
- NativeCompoundFileAPIs.cs
- EntityDataSourceWrapperCollection.cs
- CoreSwitches.cs
- XmlCharacterData.cs
- CorrelationToken.cs
- MemoryMappedViewStream.cs
- UnsafeNativeMethods.cs
- DataBoundControl.cs
- GradientStop.cs
- RowUpdatedEventArgs.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- LocalBuilder.cs
- XPathScanner.cs
- Point3DAnimation.cs
- SQlBooleanStorage.cs
- SweepDirectionValidation.cs
- MetadataPropertyAttribute.cs
- WebPartAddingEventArgs.cs
- DBConnection.cs
- MetadataArtifactLoaderCompositeResource.cs
- NavigationProperty.cs
- PageBuildProvider.cs
- SelectedGridItemChangedEvent.cs
- FileRegion.cs
- DataRowComparer.cs
- TypeConverterHelper.cs
- Operator.cs
- xmlfixedPageInfo.cs
- UrlPropertyAttribute.cs
- EntityContainerEntitySet.cs
- Line.cs
- KnownColorTable.cs
- TypedReference.cs
- TableLayoutStyle.cs
- PasswordPropertyTextAttribute.cs
- DebugViewWriter.cs
- TransformProviderWrapper.cs
- Classification.cs
- DocumentEventArgs.cs
- MethodBody.cs
- PartitionResolver.cs
- ClaimTypeElementCollection.cs
- FormViewDeleteEventArgs.cs
- ChannelServices.cs
- SelectionChangedEventArgs.cs
- Vector.cs
- ListControlConvertEventArgs.cs
- StyleSelector.cs
- CompModSwitches.cs
- OutputCacheProviderCollection.cs
- DataGridViewCellStyle.cs
- Timeline.cs
- TextRangeEdit.cs
- CustomErrorCollection.cs
- ScrollData.cs
- ACE.cs
- ToolboxItemFilterAttribute.cs
- PolicyManager.cs
- ImageKeyConverter.cs
- FrameworkContentElementAutomationPeer.cs
- CompleteWizardStep.cs
- TypeFieldSchema.cs
- _TLSstream.cs
- MeshGeometry3D.cs
- DecimalMinMaxAggregationOperator.cs
- MetadataWorkspace.cs
- IisTraceWebEventProvider.cs