Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Configuration / HttpCachePolicyElement.cs / 1305376 / HttpCachePolicyElement.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Configuration { using System; using System.Configuration; using System.Net.Cache; using System.Xml; using System.Security.Permissions; public sealed class HttpCachePolicyElement : ConfigurationElement { public HttpCachePolicyElement() { this.properties.Add(this.maximumAge); this.properties.Add(this.maximumStale); this.properties.Add(this.minimumFresh); this.properties.Add(this.policyLevel); } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } [ConfigurationProperty(ConfigurationStrings.MaximumAge, DefaultValue = TimeSpanValidatorAttribute.TimeSpanMaxValue)] public TimeSpan MaximumAge { get { return (TimeSpan)this[this.maximumAge]; } set { this[this.maximumAge] = value; } } [ConfigurationProperty(ConfigurationStrings.MaximumStale, DefaultValue = TimeSpanValidatorAttribute.TimeSpanMinValue)] public TimeSpan MaximumStale { get { return (TimeSpan)this[this.maximumStale]; } set { this[this.maximumStale] = value; } } [ConfigurationProperty(ConfigurationStrings.MinimumFresh, DefaultValue = TimeSpanValidatorAttribute.TimeSpanMinValue)] public TimeSpan MinimumFresh { get { return (TimeSpan)this[this.minimumFresh]; } set { this[this.minimumFresh] = value; } } [ConfigurationProperty(ConfigurationStrings.PolicyLevel, IsRequired = true, DefaultValue = (HttpRequestCacheLevel) HttpRequestCacheLevel.Default)] public HttpRequestCacheLevel PolicyLevel { get { return (HttpRequestCacheLevel)this[this.policyLevel]; } set { this[this.policyLevel] = value; } } protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey) { wasReadFromConfig = true; base.DeserializeElement(reader, serializeCollectionKey); } protected override void Reset(ConfigurationElement parentElement ) { if (parentElement != null) { HttpCachePolicyElement http = (HttpCachePolicyElement)parentElement; this.wasReadFromConfig = http.wasReadFromConfig; } base.Reset(parentElement ); } internal bool WasReadFromConfig { get { return this.wasReadFromConfig; } } bool wasReadFromConfig = false; ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty maximumAge = new ConfigurationProperty(ConfigurationStrings.MaximumAge, typeof(TimeSpan), TimeSpan.MaxValue, ConfigurationPropertyOptions.None); readonly ConfigurationProperty maximumStale = new ConfigurationProperty(ConfigurationStrings.MaximumStale, typeof(TimeSpan), TimeSpan.MinValue, ConfigurationPropertyOptions.None); readonly ConfigurationProperty minimumFresh = new ConfigurationProperty(ConfigurationStrings.MinimumFresh, typeof(TimeSpan), TimeSpan.MinValue, ConfigurationPropertyOptions.None); readonly ConfigurationProperty policyLevel = new ConfigurationProperty(ConfigurationStrings.PolicyLevel, typeof(HttpRequestCacheLevel), HttpRequestCacheLevel.Default, ConfigurationPropertyOptions.None); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Net.Configuration { using System; using System.Configuration; using System.Net.Cache; using System.Xml; using System.Security.Permissions; public sealed class HttpCachePolicyElement : ConfigurationElement { public HttpCachePolicyElement() { this.properties.Add(this.maximumAge); this.properties.Add(this.maximumStale); this.properties.Add(this.minimumFresh); this.properties.Add(this.policyLevel); } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } [ConfigurationProperty(ConfigurationStrings.MaximumAge, DefaultValue = TimeSpanValidatorAttribute.TimeSpanMaxValue)] public TimeSpan MaximumAge { get { return (TimeSpan)this[this.maximumAge]; } set { this[this.maximumAge] = value; } } [ConfigurationProperty(ConfigurationStrings.MaximumStale, DefaultValue = TimeSpanValidatorAttribute.TimeSpanMinValue)] public TimeSpan MaximumStale { get { return (TimeSpan)this[this.maximumStale]; } set { this[this.maximumStale] = value; } } [ConfigurationProperty(ConfigurationStrings.MinimumFresh, DefaultValue = TimeSpanValidatorAttribute.TimeSpanMinValue)] public TimeSpan MinimumFresh { get { return (TimeSpan)this[this.minimumFresh]; } set { this[this.minimumFresh] = value; } } [ConfigurationProperty(ConfigurationStrings.PolicyLevel, IsRequired = true, DefaultValue = (HttpRequestCacheLevel) HttpRequestCacheLevel.Default)] public HttpRequestCacheLevel PolicyLevel { get { return (HttpRequestCacheLevel)this[this.policyLevel]; } set { this[this.policyLevel] = value; } } protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey) { wasReadFromConfig = true; base.DeserializeElement(reader, serializeCollectionKey); } protected override void Reset(ConfigurationElement parentElement ) { if (parentElement != null) { HttpCachePolicyElement http = (HttpCachePolicyElement)parentElement; this.wasReadFromConfig = http.wasReadFromConfig; } base.Reset(parentElement ); } internal bool WasReadFromConfig { get { return this.wasReadFromConfig; } } bool wasReadFromConfig = false; ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty maximumAge = new ConfigurationProperty(ConfigurationStrings.MaximumAge, typeof(TimeSpan), TimeSpan.MaxValue, ConfigurationPropertyOptions.None); readonly ConfigurationProperty maximumStale = new ConfigurationProperty(ConfigurationStrings.MaximumStale, typeof(TimeSpan), TimeSpan.MinValue, ConfigurationPropertyOptions.None); readonly ConfigurationProperty minimumFresh = new ConfigurationProperty(ConfigurationStrings.MinimumFresh, typeof(TimeSpan), TimeSpan.MinValue, ConfigurationPropertyOptions.None); readonly ConfigurationProperty policyLevel = new ConfigurationProperty(ConfigurationStrings.PolicyLevel, typeof(HttpRequestCacheLevel), HttpRequestCacheLevel.Default, ConfigurationPropertyOptions.None); } } // 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
- QilNode.cs
- FamilyTypefaceCollection.cs
- CachedTypeface.cs
- QuaternionIndependentAnimationStorage.cs
- WMIGenerator.cs
- PipeSecurity.cs
- WorkflowApplication.cs
- Type.cs
- CfgParser.cs
- EmptyEnumerator.cs
- WebMessageEncodingBindingElement.cs
- ErrorRuntimeConfig.cs
- CollectionViewGroup.cs
- GeneralTransform3D.cs
- TypeConverterHelper.cs
- RoutedEventValueSerializer.cs
- StatusStrip.cs
- TimeEnumHelper.cs
- MouseEvent.cs
- FormatSettings.cs
- WindowsRichEdit.cs
- ImageButton.cs
- WebReferencesBuildProvider.cs
- RemoteX509Token.cs
- HwndSourceKeyboardInputSite.cs
- TypeDependencyAttribute.cs
- StrokeDescriptor.cs
- XpsThumbnail.cs
- OutputCacheSettings.cs
- ServiceOperation.cs
- TypeBuilder.cs
- ContextMenuStripGroupCollection.cs
- HttpSysSettings.cs
- ObjectNotFoundException.cs
- CodeNamespace.cs
- EDesignUtil.cs
- SerializationFieldInfo.cs
- NavigateEvent.cs
- TemplateGroupCollection.cs
- ResourceIDHelper.cs
- XamlPoint3DCollectionSerializer.cs
- StringDictionary.cs
- DirtyTextRange.cs
- AppliedDeviceFiltersEditor.cs
- RadioButtonPopupAdapter.cs
- NameValueConfigurationElement.cs
- ImageDrawing.cs
- SettingsProperty.cs
- AutoGeneratedField.cs
- ProcessModelInfo.cs
- WindowsGraphicsWrapper.cs
- AnchoredBlock.cs
- HtmlElementEventArgs.cs
- DebugView.cs
- GridViewDeletedEventArgs.cs
- PropertyCondition.cs
- SubclassTypeValidator.cs
- UserPersonalizationStateInfo.cs
- ReferencedCategoriesDocument.cs
- InitializingNewItemEventArgs.cs
- WebContext.cs
- OracleParameterCollection.cs
- ExpandableObjectConverter.cs
- HyperLinkColumn.cs
- ListChangedEventArgs.cs
- BaseDataListActionList.cs
- OrderToken.cs
- util.cs
- FormViewPageEventArgs.cs
- indexingfiltermarshaler.cs
- TextRangeSerialization.cs
- ContractComponent.cs
- ButtonPopupAdapter.cs
- PrimitiveDataContract.cs
- RequestCacheEntry.cs
- GeneralTransformCollection.cs
- DataGrid.cs
- Point4D.cs
- FixUp.cs
- ScriptComponentDescriptor.cs
- GB18030Encoding.cs
- Line.cs
- CqlQuery.cs
- CategoryNameCollection.cs
- SafeRightsManagementEnvironmentHandle.cs
- NonVisualControlAttribute.cs
- ProfileManager.cs
- BitmapEffect.cs
- ScriptingSectionGroup.cs
- TargetControlTypeCache.cs
- SafeThreadHandle.cs
- ColumnHeader.cs
- HandledMouseEvent.cs
- DataSourceXmlElementAttribute.cs
- AddInPipelineAttributes.cs
- DiscoveryClientChannelBase.cs
- ColumnProvider.cs
- HttpContext.cs
- AssignDesigner.xaml.cs
- TableRow.cs