Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / CallbackValidatorAttribute.cs / 1 / 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
- ServiceModelStringsVersion1.cs
- FilterEventArgs.cs
- CalendarSelectionChangedEventArgs.cs
- CanonicalXml.cs
- SafeProcessHandle.cs
- DataGridViewAdvancedBorderStyle.cs
- BaseTemplateParser.cs
- EventsTab.cs
- FixUpCollection.cs
- HttpConfigurationContext.cs
- Hash.cs
- ObjectDataSourceMethodEventArgs.cs
- QuaternionAnimationBase.cs
- PerformanceCounterPermission.cs
- Viewport3DVisual.cs
- DataGridViewTextBoxColumn.cs
- ConfigurationSection.cs
- ServiceSettingsResponseInfo.cs
- CellTreeSimplifier.cs
- Triplet.cs
- Typeface.cs
- HttpCookie.cs
- PasswordDeriveBytes.cs
- CngKeyCreationParameters.cs
- EntityType.cs
- HtmlWindow.cs
- NavigationFailedEventArgs.cs
- autovalidator.cs
- SendActivity.cs
- Style.cs
- PropertyManager.cs
- CategoryValueConverter.cs
- BitmapEffectGroup.cs
- DebugHandleTracker.cs
- AdPostCacheSubstitution.cs
- XmlQueryContext.cs
- PauseStoryboard.cs
- HttpHeaderCollection.cs
- OneOfTypeConst.cs
- Label.cs
- TraceSwitch.cs
- XomlCompilerHelpers.cs
- PersonalizationProviderCollection.cs
- WindowsStartMenu.cs
- SqlUnionizer.cs
- IndexedSelectQueryOperator.cs
- SelectedDatesCollection.cs
- future.cs
- NamespaceQuery.cs
- EncryptedXml.cs
- SqlCrossApplyToCrossJoin.cs
- SQLChars.cs
- TrackingCondition.cs
- EntityDataSourceChangedEventArgs.cs
- FormsAuthenticationUserCollection.cs
- SR.Designer.cs
- WebPartConnectVerb.cs
- TextSelection.cs
- ToolStripDesigner.cs
- SingleAnimationBase.cs
- XamlPoint3DCollectionSerializer.cs
- DynamicResourceExtensionConverter.cs
- ListBoxItem.cs
- EmptyEnumerable.cs
- BamlCollectionHolder.cs
- RegisteredScript.cs
- AdRotatorDesigner.cs
- BaseWebProxyFinder.cs
- SoapIgnoreAttribute.cs
- XpsLiterals.cs
- DateTimeStorage.cs
- UdpDuplexChannel.cs
- LinqDataSourceDisposeEventArgs.cs
- FontInfo.cs
- BasePropertyDescriptor.cs
- EtwTrace.cs
- DataBinding.cs
- Stream.cs
- LinkButton.cs
- XamlToRtfWriter.cs
- ToolStripDropDownClosingEventArgs.cs
- SystemFonts.cs
- XmlUtil.cs
- ContainerAction.cs
- SqlDeflator.cs
- RemotingConfiguration.cs
- RubberbandSelector.cs
- DataGridViewBand.cs
- NameTable.cs
- TypeDescriptor.cs
- DeclarativeCatalogPart.cs
- Function.cs
- XsltArgumentList.cs
- CategoryEditor.cs
- ConfigsHelper.cs
- X509CertificateValidator.cs
- AssemblyNameUtility.cs
- SqlSupersetValidator.cs
- ImageBrush.cs
- RtfToken.cs