ControlBuilder.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. //
  2. // System.Web.UI.ControlBuilder.cs
  3. //
  4. // Authors:
  5. // Duncan Mak ([email protected])
  6. // Gonzalo Paniagua Javier ([email protected])
  7. //
  8. // (C) 2002, 2003 Ximian, Inc. (http://www.ximian.com)
  9. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. using System.Collections;
  31. using System.Configuration;
  32. using System.CodeDom;
  33. using System.Globalization;
  34. using System.Reflection;
  35. using System.Security.Permissions;
  36. using System.Web.Compilation;
  37. using System.Web.Configuration;
  38. using System.IO;
  39. using System.Web.UI.WebControls;
  40. namespace System.Web.UI {
  41. // CAS
  42. [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  43. [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  44. public class ControlBuilder
  45. {
  46. internal static readonly BindingFlags FlagsNoCase = BindingFlags.Public |
  47. BindingFlags.Instance |
  48. BindingFlags.Static |
  49. BindingFlags.IgnoreCase;
  50. ControlBuilder myNamingContainer;
  51. TemplateParser parser;
  52. Type parserType;
  53. ControlBuilder parentBuilder;
  54. Type type;
  55. string tagName;
  56. string originalTagName;
  57. string id;
  58. IDictionary attribs;
  59. int line;
  60. string fileName;
  61. bool childrenAsProperties;
  62. bool isIParserAccessor = true;
  63. bool hasAspCode;
  64. ControlBuilder defaultPropertyBuilder;
  65. ArrayList children;
  66. ArrayList templateChildren;
  67. static int nextID;
  68. bool haveParserVariable;
  69. CodeMemberMethod method;
  70. CodeStatementCollection methodStatements;
  71. CodeMemberMethod renderMethod;
  72. int renderIndex;
  73. bool isProperty;
  74. ILocation location;
  75. ArrayList otherTags;
  76. public ControlBuilder ()
  77. {
  78. }
  79. internal ControlBuilder (TemplateParser parser,
  80. ControlBuilder parentBuilder,
  81. Type type,
  82. string tagName,
  83. string id,
  84. IDictionary attribs,
  85. int line,
  86. string sourceFileName)
  87. {
  88. this.parser = parser;
  89. this.parserType = parser != null ? parser.GetType () : null;
  90. this.parentBuilder = parentBuilder;
  91. this.type = type;
  92. this.tagName = tagName;
  93. this.id = id;
  94. this.attribs = attribs;
  95. this.line = line;
  96. this.fileName = sourceFileName;
  97. }
  98. internal void EnsureOtherTags ()
  99. {
  100. if (otherTags == null)
  101. otherTags = new ArrayList ();
  102. }
  103. internal ControlBuilder ParentBuilder {
  104. get { return parentBuilder; }
  105. }
  106. internal IDictionary Attributes {
  107. get { return attribs; }
  108. }
  109. internal int Line {
  110. get { return line; }
  111. set { line = value; }
  112. }
  113. internal string FileName {
  114. get { return fileName; }
  115. set { fileName = value; }
  116. }
  117. internal ControlBuilder DefaultPropertyBuilder {
  118. get { return defaultPropertyBuilder; }
  119. }
  120. internal bool HaveParserVariable {
  121. get { return haveParserVariable; }
  122. set { haveParserVariable = value; }
  123. }
  124. internal CodeMemberMethod Method {
  125. get { return method; }
  126. set { method = value; }
  127. }
  128. internal CodeStatementCollection MethodStatements {
  129. get { return methodStatements; }
  130. set { methodStatements = value; }
  131. }
  132. internal CodeMemberMethod RenderMethod {
  133. get { return renderMethod; }
  134. set { renderMethod = value; }
  135. }
  136. internal int RenderIndex {
  137. get { return renderIndex; }
  138. }
  139. internal bool IsProperty {
  140. get { return isProperty; }
  141. }
  142. internal ILocation Location {
  143. get { return location; }
  144. set { location = value; }
  145. }
  146. internal ArrayList OtherTags {
  147. get { return otherTags; }
  148. }
  149. public Type ControlType {
  150. get { return type; }
  151. }
  152. protected bool FChildrenAsProperties {
  153. get { return childrenAsProperties; }
  154. }
  155. protected bool FIsNonParserAccessor {
  156. get { return !isIParserAccessor; }
  157. }
  158. public bool HasAspCode {
  159. get { return hasAspCode; }
  160. }
  161. public string ID {
  162. get { return id; }
  163. set { id = value; }
  164. }
  165. internal ArrayList Children {
  166. get { return children; }
  167. }
  168. internal ArrayList TemplateChildren {
  169. get { return templateChildren; }
  170. }
  171. internal void SetControlType (Type t)
  172. {
  173. type = t;
  174. }
  175. protected bool InDesigner {
  176. get { return false; }
  177. }
  178. public Type NamingContainerType {
  179. get {
  180. ControlBuilder cb = myNamingContainer;
  181. if (cb == null)
  182. return typeof (Control);
  183. return cb.ControlType;
  184. }
  185. }
  186. ControlBuilder MyNamingContainer {
  187. get {
  188. if (myNamingContainer == null) {
  189. Type controlType = parentBuilder != null ? parentBuilder.ControlType : null;
  190. if (parentBuilder == null && controlType == null)
  191. myNamingContainer = null;
  192. else if (parentBuilder is TemplateBuilder)
  193. myNamingContainer = parentBuilder;
  194. else if (controlType != null && typeof (INamingContainer).IsAssignableFrom (controlType))
  195. myNamingContainer = parentBuilder;
  196. else
  197. myNamingContainer = parentBuilder.MyNamingContainer;
  198. }
  199. return myNamingContainer;
  200. }
  201. }
  202. #if NET_2_0
  203. public virtual
  204. #else
  205. internal
  206. #endif
  207. Type BindingContainerType {
  208. get {
  209. ControlBuilder cb = (this is TemplateBuilder && !(this is RootBuilder)) ? this : MyNamingContainer;
  210. if (cb == null) {
  211. if (this is RootBuilder && parserType == typeof (PageParser))
  212. return typeof (Page);
  213. return typeof (Control);
  214. }
  215. #if NET_2_0
  216. if (cb != this && cb is ContentBuilderInternal && !typeof (INonBindingContainer).IsAssignableFrom (cb.BindingContainerType))
  217. return cb.BindingContainerType;
  218. #endif
  219. Type ct;
  220. if (cb is TemplateBuilder) {
  221. ct = ((TemplateBuilder) cb).ContainerType;
  222. if (typeof (INonBindingContainer).IsAssignableFrom (ct))
  223. return MyNamingContainer.BindingContainerType;
  224. if (ct != null)
  225. return ct;
  226. ct = cb.ControlType;
  227. if (ct == null)
  228. return typeof (Control);
  229. if (typeof (INonBindingContainer).IsAssignableFrom (ct) || !typeof (INamingContainer).IsAssignableFrom (ct))
  230. return MyNamingContainer.BindingContainerType;
  231. return ct;
  232. }
  233. ct = cb.ControlType;
  234. if (ct == null)
  235. return typeof (Control);
  236. if (typeof (INonBindingContainer).IsAssignableFrom (ct) || !typeof (INamingContainer).IsAssignableFrom (ct))
  237. return MyNamingContainer.BindingContainerType;
  238. return cb.ControlType;
  239. }
  240. }
  241. internal TemplateBuilder ParentTemplateBuilder {
  242. get {
  243. if (parentBuilder == null)
  244. return null;
  245. else if (parentBuilder is TemplateBuilder)
  246. return (TemplateBuilder) parentBuilder;
  247. else
  248. return parentBuilder.ParentTemplateBuilder;
  249. }
  250. }
  251. protected TemplateParser Parser {
  252. get { return parser; }
  253. }
  254. public string TagName {
  255. get { return tagName; }
  256. }
  257. internal string OriginalTagName {
  258. get {
  259. if (originalTagName == null || originalTagName.Length == 0)
  260. return TagName;
  261. return originalTagName;
  262. }
  263. }
  264. internal RootBuilder Root {
  265. get {
  266. if (GetType () == typeof (RootBuilder))
  267. return (RootBuilder) this;
  268. return (RootBuilder) parentBuilder.Root;
  269. }
  270. }
  271. internal bool ChildrenAsProperties {
  272. get { return childrenAsProperties; }
  273. }
  274. internal string GetAttribute (string name)
  275. {
  276. if (attribs == null)
  277. return null;
  278. return attribs [name] as string;
  279. }
  280. internal void IncreaseRenderIndex ()
  281. {
  282. renderIndex++;
  283. }
  284. void AddChild (object child)
  285. {
  286. if (children == null)
  287. children = new ArrayList ();
  288. children.Add (child);
  289. ControlBuilder cb = child as ControlBuilder;
  290. if (cb != null && cb is TemplateBuilder) {
  291. if (templateChildren == null)
  292. templateChildren = new ArrayList ();
  293. templateChildren.Add (child);
  294. }
  295. #if NET_2_0
  296. if (parser == null)
  297. return;
  298. string tag = cb != null ? cb.TagName : null;
  299. if (String.IsNullOrEmpty (tag))
  300. return;
  301. RootBuilder rb = Root;
  302. AspComponentFoundry foundry = rb != null ? rb.Foundry : null;
  303. if (foundry == null)
  304. return;
  305. AspComponent component = foundry.GetComponent (tag);
  306. if (component == null || !component.FromConfig)
  307. return;
  308. parser.AddImport (component.Namespace);
  309. parser.AddDependency (component.Source);
  310. #endif
  311. }
  312. public virtual bool AllowWhitespaceLiterals ()
  313. {
  314. return true;
  315. }
  316. public virtual void AppendLiteralString (string s)
  317. {
  318. if (s == null || s.Length == 0)
  319. return;
  320. if (childrenAsProperties || !isIParserAccessor) {
  321. if (defaultPropertyBuilder != null) {
  322. defaultPropertyBuilder.AppendLiteralString (s);
  323. } else if (s.Trim ().Length != 0) {
  324. throw new HttpException (String.Format ("Literal content not allowed for '{0}' {1} \"{2}\"",
  325. tagName, GetType (), s));
  326. }
  327. return;
  328. }
  329. if (!AllowWhitespaceLiterals () && s.Trim ().Length == 0)
  330. return;
  331. if (HtmlDecodeLiterals ())
  332. s = HttpUtility.HtmlDecode (s);
  333. AddChild (s);
  334. }
  335. public virtual void AppendSubBuilder (ControlBuilder subBuilder)
  336. {
  337. subBuilder.OnAppendToParentBuilder (this);
  338. subBuilder.parentBuilder = this;
  339. if (childrenAsProperties) {
  340. AppendToProperty (subBuilder);
  341. return;
  342. }
  343. if (typeof (CodeRenderBuilder).IsAssignableFrom (subBuilder.GetType ())) {
  344. AppendCode (subBuilder);
  345. return;
  346. }
  347. AddChild (subBuilder);
  348. }
  349. void AppendToProperty (ControlBuilder subBuilder)
  350. {
  351. if (typeof (CodeRenderBuilder) == subBuilder.GetType ())
  352. throw new HttpException ("Code render not supported here.");
  353. if (defaultPropertyBuilder != null) {
  354. defaultPropertyBuilder.AppendSubBuilder (subBuilder);
  355. return;
  356. }
  357. AddChild (subBuilder);
  358. }
  359. void AppendCode (ControlBuilder subBuilder)
  360. {
  361. if (type != null && !(typeof (Control).IsAssignableFrom (type)))
  362. throw new HttpException ("Code render not supported here.");
  363. if (typeof (CodeRenderBuilder) == subBuilder.GetType ())
  364. hasAspCode = true;
  365. AddChild (subBuilder);
  366. }
  367. public virtual void CloseControl ()
  368. {
  369. }
  370. #if NET_2_0
  371. static Type MapTagType (Type tagType)
  372. {
  373. if (tagType == null)
  374. return null;
  375. PagesSection ps = WebConfigurationManager.GetWebApplicationSection ("system.web/pages") as PagesSection;
  376. if (ps == null)
  377. return tagType;
  378. TagMapCollection tags = ps.TagMapping;
  379. if (tags == null || tags.Count == 0)
  380. return tagType;
  381. string tagTypeName = tagType.ToString ();
  382. Type mappedType, originalType;
  383. string originalTypeName = String.Empty, mappedTypeName = String.Empty;
  384. bool missingType;
  385. Exception error;
  386. foreach (TagMapInfo tmi in tags) {
  387. error = null;
  388. originalType = null;
  389. try {
  390. originalTypeName = tmi.TagType;
  391. originalType = HttpApplication.LoadType (originalTypeName);
  392. if (originalType == null)
  393. missingType = true;
  394. else
  395. missingType = false;
  396. } catch (Exception ex) {
  397. missingType = true;
  398. error = ex;
  399. }
  400. if (missingType)
  401. throw new HttpException (String.Format ("Could not load type {0}", originalTypeName), error);
  402. if (originalTypeName == tagTypeName) {
  403. mappedTypeName = tmi.MappedTagType;
  404. error = null;
  405. mappedType = null;
  406. try {
  407. mappedType = HttpApplication.LoadType (mappedTypeName);
  408. if (mappedType == null)
  409. missingType = true;
  410. else
  411. missingType = false;
  412. } catch (Exception ex) {
  413. missingType = true;
  414. error = ex;
  415. }
  416. if (missingType)
  417. throw new HttpException (String.Format ("Could not load type {0}", mappedTypeName),
  418. error);
  419. if (!mappedType.IsSubclassOf (originalType))
  420. throw new ConfigurationErrorsException (
  421. String.Format ("The specified type '{0}' used for mapping must inherit from the original type '{1}'.", mappedTypeName, originalTypeName));
  422. return mappedType;
  423. }
  424. }
  425. return tagType;
  426. }
  427. #endif
  428. public static ControlBuilder CreateBuilderFromType (TemplateParser parser,
  429. ControlBuilder parentBuilder,
  430. Type type,
  431. string tagName,
  432. string id,
  433. IDictionary attribs,
  434. int line,
  435. string sourceFileName)
  436. {
  437. Type tagType;
  438. #if NET_2_0
  439. tagType = MapTagType (type);
  440. #else
  441. tagType = type;
  442. #endif
  443. ControlBuilder builder;
  444. object [] atts = tagType.GetCustomAttributes (typeof (ControlBuilderAttribute), true);
  445. if (atts != null && atts.Length > 0) {
  446. ControlBuilderAttribute att = (ControlBuilderAttribute) atts [0];
  447. builder = (ControlBuilder) Activator.CreateInstance (att.BuilderType);
  448. } else {
  449. builder = new ControlBuilder ();
  450. }
  451. builder.Init (parser, parentBuilder, tagType, tagName, id, attribs);
  452. builder.line = line;
  453. builder.fileName = sourceFileName;
  454. return builder;
  455. }
  456. public virtual Type GetChildControlType (string tagName, IDictionary attribs)
  457. {
  458. return null;
  459. }
  460. public virtual bool HasBody ()
  461. {
  462. return true;
  463. }
  464. public virtual bool HtmlDecodeLiterals ()
  465. {
  466. return false;
  467. }
  468. ControlBuilder CreatePropertyBuilder (string propName, TemplateParser parser, IDictionary atts)
  469. {
  470. int idx;
  471. string propertyName;
  472. if ((idx = propName.IndexOf (':')) >= 0)
  473. propertyName = propName.Substring (idx + 1);
  474. else
  475. propertyName = propName;
  476. PropertyInfo prop = type.GetProperty (propertyName, FlagsNoCase);
  477. if (prop == null) {
  478. string msg = String.Format ("Property {0} not found in type {1}", propertyName, type);
  479. throw new HttpException (msg);
  480. }
  481. Type propType = prop.PropertyType;
  482. ControlBuilder builder = null;
  483. if (typeof (ICollection).IsAssignableFrom (propType)) {
  484. builder = new CollectionBuilder ();
  485. } else if (typeof (ITemplate).IsAssignableFrom (propType)) {
  486. builder = new TemplateBuilder (prop);
  487. } else if (typeof (string) == propType) {
  488. builder = new StringPropertyBuilder (prop.Name);
  489. } else {
  490. builder = CreateBuilderFromType (parser, parentBuilder, propType, prop.Name,
  491. null, atts, line, fileName);
  492. builder.isProperty = true;
  493. if (idx >= 0)
  494. builder.originalTagName = propName;
  495. return builder;
  496. }
  497. builder.Init (parser, this, null, prop.Name, null, atts);
  498. builder.fileName = fileName;
  499. builder.line = line;
  500. builder.isProperty = true;
  501. if (idx >= 0)
  502. builder.originalTagName = propName;
  503. return builder;
  504. }
  505. public virtual void Init (TemplateParser parser,
  506. ControlBuilder parentBuilder,
  507. Type type,
  508. string tagName,
  509. string id,
  510. IDictionary attribs)
  511. {
  512. this.parser = parser;
  513. if (parser != null)
  514. this.location = parser.Location;
  515. this.parentBuilder = parentBuilder;
  516. this.type = type;
  517. this.tagName = tagName;
  518. this.id = id;
  519. this.attribs = attribs;
  520. if (type == null)
  521. return;
  522. if (this is TemplateBuilder)
  523. return;
  524. object [] atts = type.GetCustomAttributes (typeof (ParseChildrenAttribute), true);
  525. if (!typeof (IParserAccessor).IsAssignableFrom (type) && atts.Length == 0) {
  526. isIParserAccessor = false;
  527. childrenAsProperties = true;
  528. } else if (atts.Length > 0) {
  529. ParseChildrenAttribute att = (ParseChildrenAttribute) atts [0];
  530. childrenAsProperties = att.ChildrenAsProperties;
  531. if (childrenAsProperties && att.DefaultProperty.Length != 0)
  532. defaultPropertyBuilder = CreatePropertyBuilder (att.DefaultProperty,
  533. parser, null);
  534. }
  535. }
  536. public virtual bool NeedsTagInnerText ()
  537. {
  538. return false;
  539. }
  540. public virtual void OnAppendToParentBuilder (ControlBuilder parentBuilder)
  541. {
  542. if (defaultPropertyBuilder == null)
  543. return;
  544. ControlBuilder old = defaultPropertyBuilder;
  545. defaultPropertyBuilder = null;
  546. AppendSubBuilder (old);
  547. }
  548. internal void SetTagName (string name)
  549. {
  550. tagName = name;
  551. }
  552. public virtual void SetTagInnerText (string text)
  553. {
  554. }
  555. internal string GetNextID (string proposedID)
  556. {
  557. if (proposedID != null && proposedID.Trim ().Length != 0)
  558. return proposedID;
  559. return "_bctrl_" + nextID++;
  560. }
  561. internal virtual ControlBuilder CreateSubBuilder (string tagid,
  562. Hashtable atts,
  563. Type childType,
  564. TemplateParser parser,
  565. ILocation location)
  566. {
  567. ControlBuilder childBuilder = null;
  568. if (childrenAsProperties) {
  569. if (defaultPropertyBuilder == null)
  570. childBuilder = CreatePropertyBuilder (tagid, parser, atts);
  571. else {
  572. if (String.Compare (defaultPropertyBuilder.TagName, tagid, true, CultureInfo.InvariantCulture) == 0) {
  573. // The child tag is the same what our default property name. Act as if there was
  574. // no default property builder, or otherwise we'll end up with invalid nested
  575. // builder call.
  576. defaultPropertyBuilder = null;
  577. childBuilder = CreatePropertyBuilder (tagid, parser, atts);
  578. } else
  579. childBuilder = defaultPropertyBuilder.CreateSubBuilder (tagid, atts,
  580. null, parser,
  581. location);
  582. }
  583. return childBuilder;
  584. }
  585. if (String.Compare (tagName, tagid, true, CultureInfo.InvariantCulture) == 0)
  586. return null;
  587. childType = GetChildControlType (tagid, atts);
  588. if (childType == null)
  589. return null;
  590. childBuilder = CreateBuilderFromType (parser, this, childType, tagid, id, atts,
  591. location.BeginLine, location.Filename);
  592. return childBuilder;
  593. }
  594. internal virtual object CreateInstance ()
  595. {
  596. // HtmlGenericControl, HtmlTableCell...
  597. object [] atts = type.GetCustomAttributes (typeof (ConstructorNeedsTagAttribute), true);
  598. object [] args = null;
  599. if (atts != null && atts.Length > 0) {
  600. ConstructorNeedsTagAttribute att = (ConstructorNeedsTagAttribute) atts [0];
  601. if (att.NeedsTag)
  602. args = new object [] {tagName};
  603. }
  604. return Activator.CreateInstance (type, args);
  605. }
  606. internal virtual void CreateChildren (object parent)
  607. {
  608. if (children == null || children.Count == 0)
  609. return;
  610. IParserAccessor parser = parent as IParserAccessor;
  611. if (parser == null)
  612. return;
  613. foreach (object o in children) {
  614. if (o is string) {
  615. parser.AddParsedSubObject (new LiteralControl ((string) o));
  616. } else {
  617. parser.AddParsedSubObject (((ControlBuilder) o).CreateInstance ());
  618. }
  619. }
  620. }
  621. #if NET_2_0
  622. [MonoTODO ("unsure, lack documentation")]
  623. public virtual object BuildObject ()
  624. {
  625. return CreateInstance ();
  626. }
  627. [MonoTODO]
  628. public virtual void ProcessGeneratedCode(CodeCompileUnit codeCompileUnit,
  629. CodeTypeDeclaration baseType,
  630. CodeTypeDeclaration derivedType,
  631. CodeMemberMethod buildMethod,
  632. CodeMemberMethod dataBindingMethod)
  633. {
  634. throw new NotImplementedException ();
  635. }
  636. internal void ResetState()
  637. {
  638. renderIndex = 0;
  639. haveParserVariable = false;
  640. if (Children != null) {
  641. foreach (object child in Children) {
  642. ControlBuilder cb = child as ControlBuilder;
  643. if (cb != null)
  644. cb.ResetState ();
  645. }
  646. }
  647. }
  648. #endif
  649. }
  650. }