Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Configuration / TimeoutValidationAttribute.cs / 1 / TimeoutValidationAttribute.cs
namespace System.Net { using System; using System.Configuration; using System.ComponentModel; // NOTE [[....]]: The old validation attribute was removed from System.ll and is // replaced by more flexible and robust validation/conversion design. // The change bellow is a simple fix to make things work with the least possible change ( it is an integration break ) // However, we already have a built-in support for configuration properties that store // Type names. We do reccomend that all uses of the validator bellow are converted to // properties of type Type ( instead of string ) which use the TypeNameConverter from System.Configuration.dll // Feel free to ask me for more details if you decide to do the conversion internal sealed class TimeoutValidator : ConfigurationValidatorBase { bool _zeroValid = false; internal TimeoutValidator(bool zeroValid) { _zeroValid = zeroValid; } public override bool CanValidate( Type type ) { return ( type == typeof( int ) || type == typeof( long ) ); } public override void Validate( object value ) { if (value == null) return; int timeout = (int)value; if (_zeroValid && timeout == 0) return; if (timeout <= 0 && timeout != System.Threading.Timeout.Infinite) { // Note [[....]] : This is a lab integration fix. Old code did not have any error message at this point // This code change accomplishes the same result. However its highly reccomended that a specific error message is givven // to the user so they know what exaclty is the problem ( i.e. the value must be a positive integer or be Infinite ) // To accomplish this - an exception with the specific error message could be thrown ( ArgumentException is prefferred ) throw new ConfigurationErrorsException(SR.GetString(SR.net_io_timeout_use_gt_zero)); } } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StringAnimationUsingKeyFrames.cs
- BufferedWebEventProvider.cs
- PointCollection.cs
- NullRuntimeConfig.cs
- NavigationPropertyAccessor.cs
- Screen.cs
- QilChoice.cs
- QilDataSource.cs
- DurableServiceAttribute.cs
- TableRowCollection.cs
- PartialArray.cs
- DataBoundControlParameterTarget.cs
- PanelDesigner.cs
- IdentityNotMappedException.cs
- WrappedIUnknown.cs
- WebUtil.cs
- XmlHierarchyData.cs
- TrackingLocationCollection.cs
- Thread.cs
- XmlLinkedNode.cs
- AuthenticationSection.cs
- TextBoxDesigner.cs
- HMACSHA256.cs
- HuffCodec.cs
- StrokeIntersection.cs
- DropShadowBitmapEffect.cs
- Debugger.cs
- IncomingWebRequestContext.cs
- IdleTimeoutMonitor.cs
- TCEAdapterGenerator.cs
- ImportContext.cs
- ItemList.cs
- XmlProcessingInstruction.cs
- XmlLinkedNode.cs
- Directory.cs
- XmlSchemaComplexContent.cs
- Calendar.cs
- MultiAsyncResult.cs
- RuleInfoComparer.cs
- CssClassPropertyAttribute.cs
- TextContainer.cs
- ObfuscateAssemblyAttribute.cs
- EditorBrowsableAttribute.cs
- XmlNodeList.cs
- InkCanvasInnerCanvas.cs
- MultiTouchSystemGestureLogic.cs
- Assembly.cs
- ZoomPercentageConverter.cs
- IISUnsafeMethods.cs
- PageContentAsyncResult.cs
- ADMembershipProvider.cs
- CompiledRegexRunnerFactory.cs
- MenuItemCollectionEditorDialog.cs
- Point4DValueSerializer.cs
- EntityContainer.cs
- DecoderReplacementFallback.cs
- NextPreviousPagerField.cs
- Int64.cs
- InvalidPipelineStoreException.cs
- ClientScriptManager.cs
- DigestTraceRecordHelper.cs
- XmlTypeMapping.cs
- StreamProxy.cs
- TemplateControlBuildProvider.cs
- Header.cs
- OleDbConnectionInternal.cs
- SafeJobHandle.cs
- XsdDateTime.cs
- TransformerTypeCollection.cs
- followingsibling.cs
- TableLayoutPanel.cs
- EnumValidator.cs
- OpCodes.cs
- SimpleBitVector32.cs
- Vector3DCollection.cs
- EncodingNLS.cs
- WebDisplayNameAttribute.cs
- SharedPersonalizationStateInfo.cs
- HtmlProps.cs
- MediaScriptCommandRoutedEventArgs.cs
- FileDialogCustomPlace.cs
- TextTreeRootTextBlock.cs
- ColorKeyFrameCollection.cs
- DependencyPropertyKind.cs
- TransformProviderWrapper.cs
- QueueProcessor.cs
- TemplateGroupCollection.cs
- DataSet.cs
- FontFaceLayoutInfo.cs
- MinimizableAttributeTypeConverter.cs
- StateChangeEvent.cs
- SchemaLookupTable.cs
- IERequestCache.cs
- CodeDefaultValueExpression.cs
- SqlConnectionPoolProviderInfo.cs
- CreatingCookieEventArgs.cs
- mediapermission.cs
- ReaderOutput.cs
- AnnotationResource.cs
- RelationshipNavigation.cs