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
- LicenseManager.cs
- IntegerValidatorAttribute.cs
- SHA256CryptoServiceProvider.cs
- RoleServiceManager.cs
- StylusPointProperties.cs
- ToolStripContentPanelRenderEventArgs.cs
- XsdCachingReader.cs
- FullTextLine.cs
- TreeNode.cs
- MissingMemberException.cs
- AttributeQuery.cs
- DebugView.cs
- DocumentViewerBaseAutomationPeer.cs
- WarningException.cs
- RuntimeTrackingProfile.cs
- ACL.cs
- TypedDataSetSchemaImporterExtension.cs
- PagePropertiesChangingEventArgs.cs
- Dispatcher.cs
- PasswordValidationException.cs
- VisualStyleTypesAndProperties.cs
- ChannelSinkStacks.cs
- Propagator.JoinPropagator.SubstitutingCloneVisitor.cs
- IChannel.cs
- RenderingEventArgs.cs
- SizeAnimation.cs
- PackageStore.cs
- StaticFileHandler.cs
- CaseInsensitiveHashCodeProvider.cs
- CurrentTimeZone.cs
- DataViewSettingCollection.cs
- MarshalDirectiveException.cs
- GroupBox.cs
- SqlGenericUtil.cs
- CngKey.cs
- QuaternionKeyFrameCollection.cs
- Ray3DHitTestResult.cs
- StorageEntityTypeMapping.cs
- DBConnectionString.cs
- ServiceDescriptions.cs
- UnsafeNativeMethods.cs
- RepeaterCommandEventArgs.cs
- DynamicPropertyHolder.cs
- MdiWindowListStrip.cs
- TextParagraphProperties.cs
- ServiceEndpointElementCollection.cs
- RootBrowserWindow.cs
- ReadOnlyCollectionBase.cs
- XmlEncoding.cs
- ObjectReferenceStack.cs
- ContainerFilterService.cs
- GenericEnumerator.cs
- ResizeGrip.cs
- ResourcesGenerator.cs
- SRGSCompiler.cs
- OneWayChannelFactory.cs
- RuleInfoComparer.cs
- CategoryNameCollection.cs
- webclient.cs
- PeerApplicationLaunchInfo.cs
- MetadataArtifactLoader.cs
- ScriptingSectionGroup.cs
- ImageDrawing.cs
- CatalogPartChrome.cs
- BlurBitmapEffect.cs
- AllMembershipCondition.cs
- EdgeProfileValidation.cs
- RepeatEnumerable.cs
- MetadataArtifactLoaderFile.cs
- XmlSchemaRedefine.cs
- ResourcePropertyMemberCodeDomSerializer.cs
- QueryRewriter.cs
- ComboBox.cs
- SQLResource.cs
- ClientRoleProvider.cs
- KnownIds.cs
- FixedTextBuilder.cs
- DataGridCellAutomationPeer.cs
- Char.cs
- TransformerTypeCollection.cs
- MetabaseServerConfig.cs
- Stopwatch.cs
- DialogResultConverter.cs
- ScriptingWebServicesSectionGroup.cs
- ConnectionStringsExpressionBuilder.cs
- SctClaimSerializer.cs
- ComUdtElement.cs
- ScriptControlManager.cs
- WmpBitmapEncoder.cs
- HatchBrush.cs
- WebControlsSection.cs
- SyncOperationState.cs
- MbpInfo.cs
- Attributes.cs
- WebPartMenu.cs
- JournalNavigationScope.cs
- ResolveCriteriaCD1.cs
- BackStopAuthenticationModule.cs
- PrintPreviewGraphics.cs
- GC.cs