UserControlCodeDomTreeGenerator.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Compilation / UserControlCodeDomTreeGenerator.cs / 1 / 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);

                _sourceDataClass.CustomAttributes.Add(attribDecl); 
            }
        } 
    } 
}
 
}


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK