Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / xsp / System / Web / Configuration / SqlCacheDependencyDatabase.cs / 1 / SqlCacheDependencyDatabase.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.Globalization; using System.IO; using System.Text; using System.Diagnostics; using System.Security.Permissions; // class SqlCacheDependencySection [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class SqlCacheDependencyDatabase : ConfigurationElement { private static readonly ConfigurationElementProperty s_elemProperty = new ConfigurationElementProperty(new CallbackValidator(typeof(SqlCacheDependencyDatabase), Validate)); private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propName; private static readonly ConfigurationProperty _propConnectionStringName; private static readonly ConfigurationProperty _propPollTime; static SqlCacheDependencyDatabase() { // Property initialization _properties = new ConfigurationPropertyCollection(); _propName = new ConfigurationProperty("name", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); _propConnectionStringName = new ConfigurationProperty("connectionStringName", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired); _propPollTime = new ConfigurationProperty("pollTime", typeof(int), 60000, ConfigurationPropertyOptions.None); _properties.Add(_propName); _properties.Add(_propConnectionStringName); _properties.Add(_propPollTime); } private int defaultPollTime; // This may be set by the outer node to specify the default poll time (i.e. not specified on this node) public SqlCacheDependencyDatabase(string name, string connectionStringName, int pollTime) { Name = name; ConnectionStringName = connectionStringName; PollTime = pollTime; } public SqlCacheDependencyDatabase(string name, string connectionStringName) { Name = name; ConnectionStringName = connectionStringName; } internal SqlCacheDependencyDatabase() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } protected override ConfigurationElementProperty ElementProperty { get { return s_elemProperty; } } private static void Validate(object value) { if (value == null) { throw new ArgumentNullException("sqlCacheDependencyDatabase"); } Debug.Assert(value is SqlCacheDependencyDatabase); SqlCacheDependencyDatabase elem = (SqlCacheDependencyDatabase)value; if (elem.PollTime != 0 && elem.PollTime < 500) { throw new ConfigurationErrorsException( SR.GetString(SR.Invalid_sql_cache_dep_polltime), elem.ElementInformation.Properties["pollTime"].Source, elem.ElementInformation.Properties["pollTime"].LineNumber); } } internal void CheckDefaultPollTime(int value) { // This method will be called by the outer node. // If the poolTime property is not specified in the node, then grab the one // from above. if (ElementInformation.Properties["pollTime"].ValueOrigin == PropertyValueOrigin.Default) { defaultPollTime = value; } } [ConfigurationProperty("name", IsRequired = true, IsKey = true)] [StringValidator(MinLength = 1)] public string Name { get { return (string)base[_propName]; } set { base[_propName] = value; } } [ConfigurationProperty("connectionStringName", IsRequired = true)] [StringValidator(MinLength = 1)] public string ConnectionStringName { get { return (string)base[_propConnectionStringName]; } set { base[_propConnectionStringName] = value; } } [ConfigurationProperty("pollTime", DefaultValue = 60000)] public int PollTime { get { if (ElementInformation.Properties["pollTime"].ValueOrigin == PropertyValueOrigin.Default) { return defaultPollTime; // Return the default value from outer node } else { return (int)base[_propPollTime]; } } set { base[_propPollTime] = value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.Globalization; using System.IO; using System.Text; using System.Diagnostics; using System.Security.Permissions; // class SqlCacheDependencySection [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] public sealed class SqlCacheDependencyDatabase : ConfigurationElement { private static readonly ConfigurationElementProperty s_elemProperty = new ConfigurationElementProperty(new CallbackValidator(typeof(SqlCacheDependencyDatabase), Validate)); private static ConfigurationPropertyCollection _properties; private static readonly ConfigurationProperty _propName; private static readonly ConfigurationProperty _propConnectionStringName; private static readonly ConfigurationProperty _propPollTime; static SqlCacheDependencyDatabase() { // Property initialization _properties = new ConfigurationPropertyCollection(); _propName = new ConfigurationProperty("name", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey); _propConnectionStringName = new ConfigurationProperty("connectionStringName", typeof(string), null, null, StdValidatorsAndConverters.NonEmptyStringValidator, ConfigurationPropertyOptions.IsRequired); _propPollTime = new ConfigurationProperty("pollTime", typeof(int), 60000, ConfigurationPropertyOptions.None); _properties.Add(_propName); _properties.Add(_propConnectionStringName); _properties.Add(_propPollTime); } private int defaultPollTime; // This may be set by the outer node to specify the default poll time (i.e. not specified on this node) public SqlCacheDependencyDatabase(string name, string connectionStringName, int pollTime) { Name = name; ConnectionStringName = connectionStringName; PollTime = pollTime; } public SqlCacheDependencyDatabase(string name, string connectionStringName) { Name = name; ConnectionStringName = connectionStringName; } internal SqlCacheDependencyDatabase() { } protected override ConfigurationPropertyCollection Properties { get { return _properties; } } protected override ConfigurationElementProperty ElementProperty { get { return s_elemProperty; } } private static void Validate(object value) { if (value == null) { throw new ArgumentNullException("sqlCacheDependencyDatabase"); } Debug.Assert(value is SqlCacheDependencyDatabase); SqlCacheDependencyDatabase elem = (SqlCacheDependencyDatabase)value; if (elem.PollTime != 0 && elem.PollTime < 500) { throw new ConfigurationErrorsException( SR.GetString(SR.Invalid_sql_cache_dep_polltime), elem.ElementInformation.Properties["pollTime"].Source, elem.ElementInformation.Properties["pollTime"].LineNumber); } } internal void CheckDefaultPollTime(int value) { // This method will be called by the outer node. // If the poolTime property is not specified in the node, then grab the one // from above. if (ElementInformation.Properties["pollTime"].ValueOrigin == PropertyValueOrigin.Default) { defaultPollTime = value; } } [ConfigurationProperty("name", IsRequired = true, IsKey = true)] [StringValidator(MinLength = 1)] public string Name { get { return (string)base[_propName]; } set { base[_propName] = value; } } [ConfigurationProperty("connectionStringName", IsRequired = true)] [StringValidator(MinLength = 1)] public string ConnectionStringName { get { return (string)base[_propConnectionStringName]; } set { base[_propConnectionStringName] = value; } } [ConfigurationProperty("pollTime", DefaultValue = 60000)] public int PollTime { get { if (ElementInformation.Properties["pollTime"].ValueOrigin == PropertyValueOrigin.Default) { return defaultPollTime; // Return the default value from outer node } else { return (int)base[_propPollTime]; } } set { base[_propPollTime] = value; } } } } // 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
- WebServiceHost.cs
- CalendarModeChangedEventArgs.cs
- Enlistment.cs
- CompModSwitches.cs
- DetailsViewCommandEventArgs.cs
- WorkflowApplicationIdleEventArgs.cs
- SqlServer2KCompatibilityAnnotation.cs
- TreeViewCancelEvent.cs
- BasicCommandTreeVisitor.cs
- ActivityDelegate.cs
- FormViewDeletedEventArgs.cs
- WindowsListViewGroupSubsetLink.cs
- SafeRightsManagementEnvironmentHandle.cs
- AnnotationResourceCollection.cs
- CallContext.cs
- RectValueSerializer.cs
- MachineKeySection.cs
- InvalidOperationException.cs
- RelatedEnd.cs
- SqlInternalConnectionSmi.cs
- ArrayList.cs
- EventProviderWriter.cs
- Package.cs
- StorageEntityTypeMapping.cs
- DbConvert.cs
- FontSource.cs
- TraceInternal.cs
- DesignerRegion.cs
- _LocalDataStoreMgr.cs
- OleDbErrorCollection.cs
- IDispatchConstantAttribute.cs
- HtmlSelect.cs
- VisualStyleInformation.cs
- DocumentViewerAutomationPeer.cs
- WeakHashtable.cs
- BezierSegment.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- RowType.cs
- XpsPackagingException.cs
- _ShellExpression.cs
- DocumentEventArgs.cs
- ObjectIDGenerator.cs
- SslStream.cs
- RuntimeDelegateArgument.cs
- Rect3DValueSerializer.cs
- URL.cs
- RightsManagementSuppressedStream.cs
- CommandPlan.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- SolidColorBrush.cs
- Profiler.cs
- AuthenticateEventArgs.cs
- DataObjectMethodAttribute.cs
- ISAPIRuntime.cs
- VisualState.cs
- MessageSmuggler.cs
- ArcSegment.cs
- GroupStyle.cs
- SubpageParagraph.cs
- DrawingContextWalker.cs
- HtmlEncodedRawTextWriter.cs
- ClusterSafeNativeMethods.cs
- LineMetrics.cs
- indexingfiltermarshaler.cs
- AttributedMetaModel.cs
- WindowsSecurityTokenAuthenticator.cs
- TemplatedMailWebEventProvider.cs
- FileLogRecordHeader.cs
- StringValueSerializer.cs
- XmlHierarchicalEnumerable.cs
- InteropAutomationProvider.cs
- ResourceReader.cs
- ApplicationException.cs
- MimeMultiPart.cs
- Processor.cs
- TitleStyle.cs
- BindToObject.cs
- DesignerSerializerAttribute.cs
- RoleGroupCollection.cs
- PersonalizablePropertyEntry.cs
- Directory.cs
- StringConcat.cs
- NamedPipeHostedTransportConfiguration.cs
- QueryComponents.cs
- UpnEndpointIdentityExtension.cs
- CodeDomConfigurationHandler.cs
- AssemblyCache.cs
- MouseCaptureWithinProperty.cs
- _Rfc2616CacheValidators.cs
- TextProviderWrapper.cs
- EmulateRecognizeCompletedEventArgs.cs
- CodeGen.cs
- VerificationException.cs
- DataContractSerializerOperationFormatter.cs
- LazyTextWriterCreator.cs
- DataGridViewIntLinkedList.cs
- Parameter.cs
- XsltLibrary.cs
- HMACSHA256.cs
- Geometry.cs