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
- Regex.cs
- NumberFunctions.cs
- VolatileEnlistmentState.cs
- MetabaseServerConfig.cs
- TraversalRequest.cs
- DataControlFieldCell.cs
- StructuredProperty.cs
- StylusOverProperty.cs
- XslVisitor.cs
- DataListCommandEventArgs.cs
- WebPartUtil.cs
- Classification.cs
- ProcessHostServerConfig.cs
- SymmetricAlgorithm.cs
- FormView.cs
- PasswordBox.cs
- DataGridSortCommandEventArgs.cs
- InvalidFilterCriteriaException.cs
- COM2IPerPropertyBrowsingHandler.cs
- Privilege.cs
- VBCodeProvider.cs
- RightNameExpirationInfoPair.cs
- LinkTarget.cs
- ProfessionalColorTable.cs
- Rotation3DKeyFrameCollection.cs
- SettingsSection.cs
- IImplicitResourceProvider.cs
- FileDialog.cs
- ColumnMapCopier.cs
- prefixendpointaddressmessagefiltertable.cs
- RelatedCurrencyManager.cs
- SqlBuffer.cs
- PhysicalFontFamily.cs
- TypeSystemHelpers.cs
- Single.cs
- LinkedResource.cs
- ReachPageContentSerializer.cs
- ConfigDefinitionUpdates.cs
- XmlSchemaImporter.cs
- CodeSnippetTypeMember.cs
- Fx.cs
- TouchEventArgs.cs
- UndoEngine.cs
- AppManager.cs
- MasterPage.cs
- WhereQueryOperator.cs
- GridLength.cs
- AssemblyResourceLoader.cs
- ScalarConstant.cs
- DependencyPropertyAttribute.cs
- BrowserCapabilitiesCodeGenerator.cs
- HwndHostAutomationPeer.cs
- XsdCachingReader.cs
- BuildTopDownAttribute.cs
- ThreadExceptionEvent.cs
- DbQueryCommandTree.cs
- DesignTimeTemplateParser.cs
- PolyLineSegmentFigureLogic.cs
- RequestStatusBarUpdateEventArgs.cs
- QueryConverter.cs
- DataBindingList.cs
- SecurityCriticalDataForSet.cs
- BadImageFormatException.cs
- SQLGuid.cs
- ComMethodElementCollection.cs
- BinaryKeyIdentifierClause.cs
- PolyQuadraticBezierSegment.cs
- srgsitem.cs
- PasswordRecovery.cs
- SchemaImporterExtensionElement.cs
- MessageSmuggler.cs
- LogAppendAsyncResult.cs
- SignedXml.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- KeySpline.cs
- RuleDefinitions.cs
- PrimarySelectionGlyph.cs
- ZipIOLocalFileHeader.cs
- SmtpFailedRecipientsException.cs
- RepeaterCommandEventArgs.cs
- DataGridViewCellStyleConverter.cs
- TextBox.cs
- TemplateColumn.cs
- DocumentationServerProtocol.cs
- Size.cs
- StatusBarPanel.cs
- WebPartConnectionsCloseVerb.cs
- SqlHelper.cs
- AtomParser.cs
- PriorityChain.cs
- DmlSqlGenerator.cs
- ScriptModule.cs
- ReflectionHelper.cs
- WorkflowIdleBehavior.cs
- RuntimeEnvironment.cs
- CallbackTimeoutsBehavior.cs
- _Win32.cs
- CodeMemberField.cs
- Msmq4PoisonHandler.cs
- HttpCapabilitiesBase.cs