Code:
/ FX-1434 / FX-1434 / 1.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
- _CommandStream.cs
- CodeObject.cs
- ExpressionHelper.cs
- SchemaEntity.cs
- FormatSettings.cs
- GorillaCodec.cs
- MultiTrigger.cs
- PngBitmapEncoder.cs
- Bits.cs
- Empty.cs
- ImpersonateTokenRef.cs
- SystemWebCachingSectionGroup.cs
- _NtlmClient.cs
- XmlTextReader.cs
- SearchForVirtualItemEventArgs.cs
- SingleTagSectionHandler.cs
- Separator.cs
- ValidationHelper.cs
- XPathScanner.cs
- PromptStyle.cs
- MonitoringDescriptionAttribute.cs
- Point.cs
- WindowsListViewItem.cs
- TrimSurroundingWhitespaceAttribute.cs
- ColumnHeaderConverter.cs
- CodeTypeOfExpression.cs
- LongTypeConverter.cs
- XPathArrayIterator.cs
- InvalidOperationException.cs
- SourceChangedEventArgs.cs
- TagMapCollection.cs
- IisTraceWebEventProvider.cs
- keycontainerpermission.cs
- BCLDebug.cs
- baseshape.cs
- HtmlControlAdapter.cs
- Expressions.cs
- BamlTreeMap.cs
- ListBindableAttribute.cs
- CodeSnippetStatement.cs
- CatalogZoneBase.cs
- KeyboardDevice.cs
- ValidationResult.cs
- MappingSource.cs
- TreeView.cs
- ColumnPropertiesGroup.cs
- ManifestResourceInfo.cs
- Blend.cs
- EnumConverter.cs
- EntityObject.cs
- Thickness.cs
- WeakEventTable.cs
- indexingfiltermarshaler.cs
- UriTemplateCompoundPathSegment.cs
- ThreadAbortException.cs
- DocumentPaginator.cs
- DiscardableAttribute.cs
- CompositionAdorner.cs
- OperandQuery.cs
- WebBrowserDocumentCompletedEventHandler.cs
- FormsAuthenticationModule.cs
- AsymmetricKeyExchangeFormatter.cs
- TableLayoutRowStyleCollection.cs
- GridViewRowPresenter.cs
- DiagnosticTrace.cs
- UriExt.cs
- DataGridHyperlinkColumn.cs
- RemotingServices.cs
- DataFieldConverter.cs
- Console.cs
- CleanUpVirtualizedItemEventArgs.cs
- documentsequencetextcontainer.cs
- XmlLoader.cs
- UdpContractFilterBehavior.cs
- XmlAttributeCollection.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- WithStatement.cs
- relpropertyhelper.cs
- mongolianshape.cs
- Stackframe.cs
- ActivityAction.cs
- ContractSearchPattern.cs
- ConnectionPointCookie.cs
- xml.cs
- propertytag.cs
- PictureBox.cs
- UserControlDesigner.cs
- MemberHolder.cs
- ColorAnimationBase.cs
- IItemContainerGenerator.cs
- DataGridViewRowPrePaintEventArgs.cs
- DescendentsWalker.cs
- StateItem.cs
- CqlWriter.cs
- DecoratedNameAttribute.cs
- StringInfo.cs
- Control.cs
- TextSyndicationContent.cs
- CriticalFinalizerObject.cs
- TypeInfo.cs