Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / CallbackValidatorAttribute.cs / 1305376 / CallbackValidatorAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Configuration.Internal; using System.Collections; using System.Collections.Specialized; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { [AttributeUsage(AttributeTargets.Property)] public sealed class CallbackValidatorAttribute : ConfigurationValidatorAttribute { private Type _type = null; private String _callbackMethodName = String.Empty; private ValidatorCallback _callbackMethod; public override ConfigurationValidatorBase ValidatorInstance { get { if (_callbackMethod == null) { if (_type == null) { throw new ArgumentNullException("Type"); } if (!String.IsNullOrEmpty(_callbackMethodName)) { MethodInfo methodInfo = _type.GetMethod(_callbackMethodName, BindingFlags.Public | BindingFlags.Static); if (methodInfo != null) { ParameterInfo[] parameters = methodInfo.GetParameters(); if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(Object))) { _callbackMethod = (ValidatorCallback)Delegate.CreateDelegate(typeof(ValidatorCallback), methodInfo); } } } } if (_callbackMethod == null) { throw new System.ArgumentException(SR.GetString(SR.Validator_method_not_found, _callbackMethodName)); } return new CallbackValidator(_callbackMethod); } } public CallbackValidatorAttribute() { } public Type Type { get { return _type; } set { _type = value; _callbackMethod = null; } } public String CallbackMethodName { get { return _callbackMethodName; } set { _callbackMethodName = value; _callbackMethod = null; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Configuration.Internal; using System.Collections; using System.Collections.Specialized; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { [AttributeUsage(AttributeTargets.Property)] public sealed class CallbackValidatorAttribute : ConfigurationValidatorAttribute { private Type _type = null; private String _callbackMethodName = String.Empty; private ValidatorCallback _callbackMethod; public override ConfigurationValidatorBase ValidatorInstance { get { if (_callbackMethod == null) { if (_type == null) { throw new ArgumentNullException("Type"); } if (!String.IsNullOrEmpty(_callbackMethodName)) { MethodInfo methodInfo = _type.GetMethod(_callbackMethodName, BindingFlags.Public | BindingFlags.Static); if (methodInfo != null) { ParameterInfo[] parameters = methodInfo.GetParameters(); if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(Object))) { _callbackMethod = (ValidatorCallback)Delegate.CreateDelegate(typeof(ValidatorCallback), methodInfo); } } } } if (_callbackMethod == null) { throw new System.ArgumentException(SR.GetString(SR.Validator_method_not_found, _callbackMethodName)); } return new CallbackValidator(_callbackMethod); } } public CallbackValidatorAttribute() { } public Type Type { get { return _type; } set { _type = value; _callbackMethod = null; } } public String CallbackMethodName { get { return _callbackMethodName; } set { _callbackMethodName = value; _callbackMethod = null; } } } } // 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
- EntityCommandExecutionException.cs
- HtmlSelect.cs
- DocumentReference.cs
- MediaContext.cs
- SamlAction.cs
- StrongNameKeyPair.cs
- UInt32Converter.cs
- CodeDomComponentSerializationService.cs
- Fault.cs
- KeyMatchBuilder.cs
- BamlResourceSerializer.cs
- StylusEditingBehavior.cs
- XmlQueryOutput.cs
- DataGridViewRowHeaderCell.cs
- MemberInfoSerializationHolder.cs
- HTMLTagNameToTypeMapper.cs
- PrimitiveType.cs
- BoundField.cs
- ValidatingPropertiesEventArgs.cs
- QilFunction.cs
- FontFamily.cs
- Section.cs
- IpcClientChannel.cs
- Debugger.cs
- mactripleDES.cs
- _UriSyntax.cs
- FixedDocument.cs
- ListBoxItemWrapperAutomationPeer.cs
- AsymmetricCryptoHandle.cs
- EllipseGeometry.cs
- ElementNotEnabledException.cs
- MasterPageBuildProvider.cs
- Parser.cs
- ShaperBuffers.cs
- OdbcCommandBuilder.cs
- CacheAxisQuery.cs
- DragEventArgs.cs
- DataGridColumnFloatingHeader.cs
- BufferBuilder.cs
- SourceChangedEventArgs.cs
- DataControlButton.cs
- FilteredAttributeCollection.cs
- RemoteArgument.cs
- WindowsListViewItemStartMenu.cs
- AsyncCompletedEventArgs.cs
- DesignTimeParseData.cs
- MruCache.cs
- FileIOPermission.cs
- XmlArrayItemAttribute.cs
- EdmProperty.cs
- AspNetSynchronizationContext.cs
- ViewCellRelation.cs
- CharUnicodeInfo.cs
- SeekStoryboard.cs
- ParseChildrenAsPropertiesAttribute.cs
- WS2007FederationHttpBindingCollectionElement.cs
- odbcmetadatacollectionnames.cs
- VersionedStream.cs
- VirtualPath.cs
- Pair.cs
- ButtonChrome.cs
- RequiredFieldValidator.cs
- ProtocolsConfiguration.cs
- FieldMetadata.cs
- MergeLocalizationDirectives.cs
- XsdDuration.cs
- ToolStripDropTargetManager.cs
- ComplexLine.cs
- StrokeNode.cs
- StateRuntime.cs
- InternalResources.cs
- ImageSource.cs
- SelectionEditingBehavior.cs
- FontWeightConverter.cs
- Expression.cs
- QuestionEventArgs.cs
- SiteMapDataSourceDesigner.cs
- SafeProcessHandle.cs
- EventMappingSettings.cs
- PersonalizablePropertyEntry.cs
- ConfigurationPropertyCollection.cs
- ToolStrip.cs
- XmlCharacterData.cs
- ISO2022Encoding.cs
- ValidationRule.cs
- XpsFilter.cs
- CodeRegionDirective.cs
- DataTableNewRowEvent.cs
- DataGridViewDataConnection.cs
- DebugView.cs
- MaskedTextProvider.cs
- TextRangeEditTables.cs
- SendSecurityHeaderElement.cs
- TextChange.cs
- WebPartConnectionCollection.cs
- RolePrincipal.cs
- ElementInit.cs
- FrameworkRichTextComposition.cs
- PropertyDescriptorComparer.cs
- FlowDocumentReaderAutomationPeer.cs