Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Configuration / ReliableMessagingVersionConverter.cs / 1 / ReliableMessagingVersionConverter.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { //using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; class ReliableMessagingVersionConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (typeof(string) == sourceType) { return true; } return base.CanConvertFrom(context, sourceType); } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (typeof(InstanceDescriptor) == destinationType) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string version = value as string; #pragma warning suppress 56507 // [....], Really checking for null (meaning value was not a string) versus String.Empty if (version != null) { switch (version) { case ConfigurationStrings.Default: return ReliableMessagingVersion.Default; case ConfigurationStrings.WSReliableMessaging11: return ReliableMessagingVersion.WSReliableMessaging11; case ConfigurationStrings.WSReliableMessagingFebruary2005: return ReliableMessagingVersion.WSReliableMessagingFebruary2005; default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ConfigInvalidReliableMessagingVersionValue, version)); } } return base.ConvertFrom(context, culture, value); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (typeof(string) == destinationType && value is ReliableMessagingVersion) { ReliableMessagingVersion version = (ReliableMessagingVersion)value; if (version == ReliableMessagingVersion.Default) { return ConfigurationStrings.Default; } else if (version == ReliableMessagingVersion.WSReliableMessaging11) { return ConfigurationStrings.WSReliableMessaging11; } else if (version == ReliableMessagingVersion.WSReliableMessagingFebruary2005) { return ConfigurationStrings.WSReliableMessagingFebruary2005; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value", SR.GetString(SR.ConfigInvalidClassInstanceValue, typeof(ReliableMessagingVersion).FullName))); } } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- SqlLiftIndependentRowExpressions.cs
- EntityTypeBase.cs
- XmlAttributeCollection.cs
- ServiceTimeoutsElement.cs
- NumericPagerField.cs
- mediaeventargs.cs
- PointCollection.cs
- InstanceDataCollection.cs
- StateBag.cs
- PassportAuthenticationModule.cs
- HostSecurityManager.cs
- ConfigurationSectionGroupCollection.cs
- AddInController.cs
- AutomationEvent.cs
- SortExpressionBuilder.cs
- ServerIdentity.cs
- PointLight.cs
- ModelTreeEnumerator.cs
- SecurityContext.cs
- WebPartZone.cs
- FixedSOMLineCollection.cs
- TemplatedMailWebEventProvider.cs
- DoubleAnimationBase.cs
- SelectedDatesCollection.cs
- DetailsViewUpdatedEventArgs.cs
- MenuItem.cs
- Hyperlink.cs
- XmlDocumentViewSchema.cs
- CharacterHit.cs
- RectAnimationBase.cs
- ClientSideQueueItem.cs
- BulletedListEventArgs.cs
- Vector3DAnimationUsingKeyFrames.cs
- PrintPageEvent.cs
- AdornerLayer.cs
- TextRangeEditTables.cs
- InfiniteTimeSpanConverter.cs
- ListArgumentProvider.cs
- SafeNativeMethodsOther.cs
- MarkupObject.cs
- InternalControlCollection.cs
- ControlPaint.cs
- Process.cs
- ExtensionFile.cs
- ActiveXContainer.cs
- InstanceView.cs
- CompModSwitches.cs
- FileRegion.cs
- MLangCodePageEncoding.cs
- ParseChildrenAsPropertiesAttribute.cs
- SchemaExporter.cs
- Int32CollectionValueSerializer.cs
- TableParaClient.cs
- EditorPartCollection.cs
- SystemShuttingDownException.cs
- WindowsRichEdit.cs
- HandleValueEditor.cs
- WebEvents.cs
- GridPatternIdentifiers.cs
- SymbolTable.cs
- XhtmlBasicValidationSummaryAdapter.cs
- UnauthorizedAccessException.cs
- Cast.cs
- MediaSystem.cs
- WebResourceAttribute.cs
- SortedDictionary.cs
- BezierSegment.cs
- QuaternionValueSerializer.cs
- TextRange.cs
- XmlAggregates.cs
- ValueQuery.cs
- DBConnectionString.cs
- SequentialWorkflowRootDesigner.cs
- WebScriptClientGenerator.cs
- CommonObjectSecurity.cs
- SqlTransaction.cs
- PropertyChangingEventArgs.cs
- DataColumnMapping.cs
- GridPatternIdentifiers.cs
- EventLogPermissionAttribute.cs
- XmlDataLoader.cs
- BatchParser.cs
- SuppressMessageAttribute.cs
- ModuleElement.cs
- CodeRegionDirective.cs
- EventsTab.cs
- ProtocolsConfiguration.cs
- HtmlTableRow.cs
- RSAOAEPKeyExchangeFormatter.cs
- XmlBinaryReader.cs
- TreeView.cs
- NativeCompoundFileAPIs.cs
- BrowsableAttribute.cs
- OleDbConnectionFactory.cs
- GeneralTransform3DCollection.cs
- ToolStripItemGlyph.cs
- JulianCalendar.cs
- UnicodeEncoding.cs
- WebServiceMethodData.cs
- ViewEventArgs.cs