Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Compilation / UserControlCodeDomTreeGenerator.cs / 1305376 / UserControlCodeDomTreeGenerator.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Compilation {
using System;
using System.CodeDom;
using System.Web.UI;
internal class UserControlCodeDomTreeGenerator : TemplateControlCodeDomTreeGenerator {
protected UserControlParser _ucParser;
UserControlParser Parser { get { return _ucParser; } }
internal UserControlCodeDomTreeGenerator(UserControlParser ucParser) : base(ucParser) {
_ucParser = ucParser;
}
/*
* Add metadata attributes to the class
*/
protected override void GenerateClassAttributes() {
base.GenerateClassAttributes();
// If the user control has an OutputCache directive, generate
// an attribute with the information about it.
if (_sourceDataClass != null && Parser.OutputCacheParameters != null) {
OutputCacheParameters cacheSettings = Parser.OutputCacheParameters;
if (cacheSettings.Duration > 0) {
CodeAttributeDeclaration attribDecl = new CodeAttributeDeclaration(
"System.Web.UI.PartialCachingAttribute");
CodeAttributeArgument attribArg = new CodeAttributeArgument(
new CodePrimitiveExpression(cacheSettings.Duration));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByParam));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByControl));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByCustom));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.SqlDependency));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(Parser.FSharedPartialCaching));
attribDecl.Arguments.Add(attribArg);
// Use the providerName argument only when targeting 4.0 and above.
if (MultiTargetingUtil.IsTargetFramework40OrAbove) {
attribArg = new CodeAttributeArgument("ProviderName", new CodePrimitiveExpression(Parser.Provider));
attribDecl.Arguments.Add(attribArg);
}
_sourceDataClass.CustomAttributes.Add(attribDecl);
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Compilation {
using System;
using System.CodeDom;
using System.Web.UI;
internal class UserControlCodeDomTreeGenerator : TemplateControlCodeDomTreeGenerator {
protected UserControlParser _ucParser;
UserControlParser Parser { get { return _ucParser; } }
internal UserControlCodeDomTreeGenerator(UserControlParser ucParser) : base(ucParser) {
_ucParser = ucParser;
}
/*
* Add metadata attributes to the class
*/
protected override void GenerateClassAttributes() {
base.GenerateClassAttributes();
// If the user control has an OutputCache directive, generate
// an attribute with the information about it.
if (_sourceDataClass != null && Parser.OutputCacheParameters != null) {
OutputCacheParameters cacheSettings = Parser.OutputCacheParameters;
if (cacheSettings.Duration > 0) {
CodeAttributeDeclaration attribDecl = new CodeAttributeDeclaration(
"System.Web.UI.PartialCachingAttribute");
CodeAttributeArgument attribArg = new CodeAttributeArgument(
new CodePrimitiveExpression(cacheSettings.Duration));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByParam));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByControl));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.VaryByCustom));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(cacheSettings.SqlDependency));
attribDecl.Arguments.Add(attribArg);
attribArg = new CodeAttributeArgument(new CodePrimitiveExpression(Parser.FSharedPartialCaching));
attribDecl.Arguments.Add(attribArg);
// Use the providerName argument only when targeting 4.0 and above.
if (MultiTargetingUtil.IsTargetFramework40OrAbove) {
attribArg = new CodeAttributeArgument("ProviderName", new CodePrimitiveExpression(Parser.Provider));
attribDecl.Arguments.Add(attribArg);
}
_sourceDataClass.CustomAttributes.Add(attribDecl);
}
}
}
}
}
// 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
- UriScheme.cs
- EvidenceTypeDescriptor.cs
- ProcessHost.cs
- ResourceDictionary.cs
- DataSourceControlBuilder.cs
- CaseInsensitiveOrdinalStringComparer.cs
- ReferencedAssembly.cs
- DateTimePicker.cs
- QueryOutputWriter.cs
- JoinCqlBlock.cs
- CopyNodeSetAction.cs
- BindingCollection.cs
- FixedSOMElement.cs
- SupportsEventValidationAttribute.cs
- HttpModuleActionCollection.cs
- Border.cs
- ScrollableControl.cs
- RoutedCommand.cs
- ValuePattern.cs
- EdmTypeAttribute.cs
- AuthStoreRoleProvider.cs
- UITypeEditor.cs
- ExceptionUtil.cs
- ResourceExpression.cs
- Hex.cs
- RouteValueDictionary.cs
- BrowserTree.cs
- ScrollEvent.cs
- CompiledQueryCacheKey.cs
- MenuBindingsEditor.cs
- GeneralTransform3DTo2DTo3D.cs
- NumericPagerField.cs
- OracleException.cs
- UserPreferenceChangedEventArgs.cs
- DateTimeValueSerializer.cs
- TypeResolver.cs
- OleDbFactory.cs
- SamlAuthenticationStatement.cs
- TemplateBamlTreeBuilder.cs
- TextRenderingModeValidation.cs
- WebInvokeAttribute.cs
- CompatibleComparer.cs
- NameSpaceExtractor.cs
- UdpConstants.cs
- Pair.cs
- DataGridTableCollection.cs
- InstallerTypeAttribute.cs
- Span.cs
- FlowDocumentFormatter.cs
- DateTime.cs
- SafeViewOfFileHandle.cs
- CustomErrorCollection.cs
- TreeView.cs
- SendKeys.cs
- SpellerError.cs
- PtsHost.cs
- DirectoryNotFoundException.cs
- StrongNameUtility.cs
- TextStore.cs
- SyndicationCategory.cs
- CountAggregationOperator.cs
- PrePostDescendentsWalker.cs
- PickBranchDesigner.xaml.cs
- UidPropertyAttribute.cs
- TitleStyle.cs
- GradientStop.cs
- AdapterUtil.cs
- WebBrowserProgressChangedEventHandler.cs
- BoolExpr.cs
- CompilationUtil.cs
- WindowsListViewGroup.cs
- HMACMD5.cs
- TreeNodeClickEventArgs.cs
- LambdaCompiler.Lambda.cs
- CacheForPrimitiveTypes.cs
- CultureNotFoundException.cs
- VirtualizedCellInfoCollection.cs
- ProtocolsSection.cs
- DataRow.cs
- WinFormsSecurity.cs
- ClassicBorderDecorator.cs
- SparseMemoryStream.cs
- ChooseAction.cs
- TemplatePropertyEntry.cs
- XamlFilter.cs
- DeadLetterQueue.cs
- DocumentGrid.cs
- RemoteWebConfigurationHostServer.cs
- FamilyCollection.cs
- SqlReorderer.cs
- ParameterReplacerVisitor.cs
- IdentityManager.cs
- ETagAttribute.cs
- TextTreeUndo.cs
- HttpServerProtocol.cs
- OleDbDataAdapter.cs
- PointConverter.cs
- DisableDpiAwarenessAttribute.cs
- WebPartChrome.cs
- XPathDocument.cs