Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Configuration / SoapExtensionTypeElement.cs / 1305376 / SoapExtensionTypeElement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Web.Services.Configuration { using System; using System.ComponentModel; using System.Configuration; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Security.Permissions; public sealed class SoapExtensionTypeElement : ConfigurationElement { // These three constructors are used by the configuration system. public SoapExtensionTypeElement() : base() { this.properties.Add(this.group); this.properties.Add(this.priority); this.properties.Add(this.type); } public SoapExtensionTypeElement(string type, int priority, PriorityGroup group) : this() { this.Type = Type.GetType(type, true, true); this.Priority = priority; this.Group = group; } public SoapExtensionTypeElement(Type type, int priority, PriorityGroup group) : this(type.AssemblyQualifiedName, priority, group) { } [ConfigurationProperty("group", IsKey = true, DefaultValue = PriorityGroup.Low)] public PriorityGroup Group { get { return (PriorityGroup)base[this.group]; } set { if (Enum.IsDefined(typeof(PriorityGroup), value)) { base[this.group] = value; } else { throw new ArgumentException(Res.GetString(Res.Invalid_priority_group_value), "value"); } } } [ConfigurationProperty("priority", IsKey = true, DefaultValue = 0)] [IntegerValidator(MinValue = 0)] public int Priority { get { return (int)base[this.priority]; } set { base[this.priority] = value; } } [ConfigurationProperty("type", IsKey = true)] [TypeConverter(typeof(TypeTypeConverter))] public Type Type { get { return (Type)base[this.type]; } set { base[this.type] = value; } } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty group = new ConfigurationProperty("group", typeof(PriorityGroup), PriorityGroup.Low, new EnumConverter(typeof(PriorityGroup)), null, ConfigurationPropertyOptions.IsKey); readonly ConfigurationProperty priority = new ConfigurationProperty("priority", typeof(int), 0, null, new IntegerValidator( 0, int.MaxValue ), ConfigurationPropertyOptions.IsKey); readonly ConfigurationProperty type = new ConfigurationProperty("type", typeof(Type), null, new TypeTypeConverter(), null, ConfigurationPropertyOptions.IsKey); } class TypeTypeConverter : TypeAndNameConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { return base.CanConvertFrom(context, sourceType); } public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { TypeAndName baseValue = (TypeAndName)base.ConvertFrom(context, culture, value); return baseValue.type; } return base.ConvertFrom(context, culture, value); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string)) { TypeAndName castedValue = new TypeAndName((Type)value); return base.ConvertTo(context, culture, castedValue, destinationType); } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- ContextMenu.cs
- TextBoxAutoCompleteSourceConverter.cs
- XmlImplementation.cs
- TraceListeners.cs
- SecurityKeyEntropyMode.cs
- _Rfc2616CacheValidators.cs
- ValidationErrorCollection.cs
- DataGridViewEditingControlShowingEventArgs.cs
- SiteMapNodeItemEventArgs.cs
- FontInfo.cs
- DockPattern.cs
- XmlDomTextWriter.cs
- LinqDataSourceValidationException.cs
- HtmlTable.cs
- PagerSettings.cs
- DataRowChangeEvent.cs
- FileCodeGroup.cs
- LinearGradientBrush.cs
- DrawingContextDrawingContextWalker.cs
- GenericXmlSecurityTokenAuthenticator.cs
- CompositeControl.cs
- HttpCachePolicy.cs
- PTConverter.cs
- columnmapfactory.cs
- DataPagerFieldItem.cs
- _ScatterGatherBuffers.cs
- CodeCatchClauseCollection.cs
- UnsafeNativeMethods.cs
- IndentedTextWriter.cs
- DataGridSortingEventArgs.cs
- UserControl.cs
- EventLogPermissionEntry.cs
- SecurityTokenTypes.cs
- _NestedMultipleAsyncResult.cs
- TypeElementCollection.cs
- DynamicValueConverter.cs
- CultureInfoConverter.cs
- MimeBasePart.cs
- ManifestBasedResourceGroveler.cs
- SoapIncludeAttribute.cs
- MessageAction.cs
- ResolveDuplexCD1AsyncResult.cs
- ButtonFieldBase.cs
- NodeLabelEditEvent.cs
- EncryptedPackage.cs
- AnnotationDocumentPaginator.cs
- WebPartCatalogCloseVerb.cs
- SecurityHelper.cs
- QilList.cs
- ItemContainerGenerator.cs
- RemoteHelper.cs
- CrossSiteScriptingValidation.cs
- TextTreeUndo.cs
- StylusPlugInCollection.cs
- ZipIOExtraField.cs
- SpeechSynthesizer.cs
- Parsers.cs
- NotConverter.cs
- SequentialUshortCollection.cs
- ActiveXHelper.cs
- ScriptManagerProxy.cs
- SymbolEqualComparer.cs
- ProcessHostConfigUtils.cs
- DateTimeSerializationSection.cs
- FacetEnabledSchemaElement.cs
- cryptoapiTransform.cs
- AppDomainUnloadedException.cs
- VsPropertyGrid.cs
- XmlSerializerAssemblyAttribute.cs
- SqlDataSourceStatusEventArgs.cs
- DesignTimeVisibleAttribute.cs
- DrawingGroup.cs
- UnsafeNativeMethods.cs
- RegistryDataKey.cs
- HttpWebResponse.cs
- DesignerDataTable.cs
- CounterCreationDataCollection.cs
- StackOverflowException.cs
- IdnMapping.cs
- ToolStripControlHost.cs
- CellCreator.cs
- DoubleAnimationUsingKeyFrames.cs
- OperationPickerDialog.designer.cs
- EmptyEnumerator.cs
- RoleGroupCollection.cs
- WebConvert.cs
- ColumnResizeUndoUnit.cs
- EmptyCollection.cs
- CodeVariableDeclarationStatement.cs
- ParenthesizePropertyNameAttribute.cs
- EncoderBestFitFallback.cs
- XmlSchemaExporter.cs
- RegistrationProxy.cs
- ResourceExpressionBuilder.cs
- X509ChainPolicy.cs
- User.cs
- UpdateTracker.cs
- BinaryVersion.cs
- RawAppCommandInputReport.cs
- DataGridToolTip.cs