Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / Configuration / HttpCachePolicyElement.cs / 1 / 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);
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScrollViewer.cs
- KeyMatchBuilder.cs
- BitmapEffectGroup.cs
- VBCodeProvider.cs
- DragDropManager.cs
- BamlLocalizableResource.cs
- NCryptNative.cs
- CurrentChangedEventManager.cs
- PixelFormat.cs
- SQLInt64.cs
- CodeEntryPointMethod.cs
- FullTextState.cs
- CqlLexerHelpers.cs
- FixedSOMTableCell.cs
- WebPartZoneBase.cs
- Vector3dCollection.cs
- MissingMethodException.cs
- SessionStateModule.cs
- COM2IProvidePropertyBuilderHandler.cs
- Matrix3DConverter.cs
- EmptyCollection.cs
- Light.cs
- ListMarkerLine.cs
- ToolStripRendererSwitcher.cs
- HasCopySemanticsAttribute.cs
- BevelBitmapEffect.cs
- DateTimeOffsetStorage.cs
- RuntimeCompatibilityAttribute.cs
- ForwardPositionQuery.cs
- InheritanceContextHelper.cs
- SizeAnimationBase.cs
- SpellerError.cs
- ValueProviderWrapper.cs
- SafePointer.cs
- RenamedEventArgs.cs
- FixedTextBuilder.cs
- FormsAuthenticationTicket.cs
- RSAPKCS1SignatureDeformatter.cs
- PrinterSettings.cs
- RuleSetBrowserDialog.cs
- DataGridState.cs
- LassoHelper.cs
- AuthenticationService.cs
- StrokeFIndices.cs
- CodeBlockBuilder.cs
- DPCustomTypeDescriptor.cs
- ProvidersHelper.cs
- CategoryAttribute.cs
- Button.cs
- LogWriteRestartAreaAsyncResult.cs
- Attributes.cs
- TypeDescriptionProvider.cs
- RangeValueProviderWrapper.cs
- SafeSecurityHandles.cs
- SafeProcessHandle.cs
- Item.cs
- EventsTab.cs
- PasswordTextContainer.cs
- WebServiceHost.cs
- BuildProviderAppliesToAttribute.cs
- RadioButton.cs
- ScriptHandlerFactory.cs
- XmlSchemaSimpleContentRestriction.cs
- Operand.cs
- AppSettingsExpressionEditor.cs
- HttpProfileGroupBase.cs
- DetailsViewModeEventArgs.cs
- SmtpCommands.cs
- SystemResourceHost.cs
- DoubleUtil.cs
- Animatable.cs
- DoubleLink.cs
- ThemeInfoAttribute.cs
- WebBrowser.cs
- SelectionListDesigner.cs
- OleDbInfoMessageEvent.cs
- TaskHelper.cs
- XmlQueryStaticData.cs
- RootProfilePropertySettingsCollection.cs
- InfoCardSymmetricAlgorithm.cs
- DependencyObjectProvider.cs
- RelationshipFixer.cs
- PieceDirectory.cs
- DockAndAnchorLayout.cs
- ConsoleTraceListener.cs
- CheckedListBox.cs
- TargetControlTypeCache.cs
- PropertyPathConverter.cs
- SqlBuffer.cs
- CancelEventArgs.cs
- ContractListAdapter.cs
- Quaternion.cs
- XslTransform.cs
- ConsumerConnectionPoint.cs
- WindowsToolbar.cs
- ScaleTransform3D.cs
- MarshalDirectiveException.cs
- InfoCardCryptoHelper.cs
- DBNull.cs
- DiscoveryReferences.cs