2004-01-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / StaticPartialCachingControl.cs
1 //
2 // System.Web.UI.StaticPartialCachingControl.cs
3 //
4 // Author:
5 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
6 //
7 // (C) 2003 Andreas Nahr
8 //
9
10 using System;
11 using System.ComponentModel;
12
13 namespace System.Web.UI
14 {
15         public class StaticPartialCachingControl : BasePartialCachingControl
16         {
17
18                 private BuildMethod buildMethod;
19
20                 public StaticPartialCachingControl (string ctrlID, string guid, int duration,
21                                 string varyByParams, string varyByControls, string varyByCustom,
22                                 BuildMethod buildMethod)
23                 {
24                         CtrlID = ctrlID;
25                         Guid = guid;
26                         Duration = duration;
27                         VaryByParams = varyByParams;
28                         VaryByControls = varyByControls;
29                         VaryByCustom = varyByCustom;
30                         
31                         this.buildMethod = buildMethod;
32                 }
33
34                 public static void BuildCachedControl (Control parent, string ctrlID, string guid,
35                                 int duration, string varyByParams, string varyByControls,
36                                 string varyByCustom, BuildMethod buildMethod)
37                 {
38                         StaticPartialCachingControl NewControl =
39                                 new StaticPartialCachingControl (ctrlID, guid, duration,
40                                                 varyByParams, varyByControls, varyByCustom,
41                                                 buildMethod);
42
43                         parent.Controls.Add (NewControl);
44                 }
45
46                 internal override Control CreateControl()
47                 {
48                        return buildMethod ();
49                 }
50         }
51 }