public override void AppendSubBuilder(ControlBuilder subBuilder)
 {
     if (subBuilder is ContentBuilderInternal)
     {
         ContentBuilderInternal internal2 = (ContentBuilderInternal)subBuilder;
         this._containsContentPage = true;
         if (this._contentBuilderEntries == null)
         {
             this._contentBuilderEntries = new ArrayList();
         }
         if (this._firstLiteralText != null)
         {
             throw new HttpParseException(System.Web.SR.GetString("Only_Content_supported_on_content_page"), null, base.Parser.CurrentVirtualPath, this._firstLiteralText, this._firstLiteralLineNumber);
         }
         if (this._firstControlBuilder != null)
         {
             base.Parser._lineNumber = this._firstControlBuilder.Line;
             throw new HttpException(System.Web.SR.GetString("Only_Content_supported_on_content_page"));
         }
         TemplatePropertyEntry entry = new TemplatePropertyEntry {
             Filter  = internal2.ContentPlaceHolderFilter,
             Name    = internal2.ContentPlaceHolder,
             Builder = internal2
         };
         this._contentBuilderEntries.Add(entry);
     }
     else if (this._firstControlBuilder == null)
     {
         if (this._containsContentPage)
         {
             throw new HttpException(System.Web.SR.GetString("Only_Content_supported_on_content_page"));
         }
         this._firstControlBuilder = subBuilder;
     }
     base.AppendSubBuilder(subBuilder);
 }
 public override void AppendSubBuilder(ControlBuilder subBuilder)
 {
     if (subBuilder is ContentBuilderInternal)
     {
         ContentBuilderInternal internal2 = (ContentBuilderInternal) subBuilder;
         this._containsContentPage = true;
         if (this._contentBuilderEntries == null)
         {
             this._contentBuilderEntries = new ArrayList();
         }
         if (this._firstLiteralText != null)
         {
             throw new HttpParseException(System.Web.SR.GetString("Only_Content_supported_on_content_page"), null, base.Parser.CurrentVirtualPath, this._firstLiteralText, this._firstLiteralLineNumber);
         }
         if (this._firstControlBuilder != null)
         {
             base.Parser._lineNumber = this._firstControlBuilder.Line;
             throw new HttpException(System.Web.SR.GetString("Only_Content_supported_on_content_page"));
         }
         TemplatePropertyEntry entry = new TemplatePropertyEntry {
             Filter = internal2.ContentPlaceHolderFilter,
             Name = internal2.ContentPlaceHolder,
             Builder = internal2
         };
         this._contentBuilderEntries.Add(entry);
     }
     else if (this._firstControlBuilder == null)
     {
         if (this._containsContentPage)
         {
             throw new HttpException(System.Web.SR.GetString("Only_Content_supported_on_content_page"));
         }
         this._firstControlBuilder = subBuilder;
     }
     base.AppendSubBuilder(subBuilder);
 }
        /// <devdoc>
        /// </devdoc>
        private void AddTemplateProperty(string filter, string name, TemplateBuilder builder) {

            /* Do not ignore template properties since we do want to generate IDs for controls defined
               inside SingleInstanceTemplates. VSWhidbey 243341
            if (IgnoreControlProperty) {
                return;
            }
            */

            Debug.Assert(!String.IsNullOrEmpty(name));
            Debug.Assert(builder != null);

            // Look for a MemberInfo
            string objectModelName = String.Empty;
            MemberInfo memberInfo = PropertyMapper.GetMemberInfo(_controlType, name, out objectModelName);

            // Setup a template entry
            bool bindableTemplate = builder is BindableTemplateBuilder;
            TemplatePropertyEntry entry = new TemplatePropertyEntry(bindableTemplate);

            entry.Builder = builder;
            entry.Filter = filter;
            entry.Name = objectModelName;

            Type memberType = null;

            if (memberInfo != null) {
                if (memberInfo is PropertyInfo) {

                    PropertyInfo propInfo = ((PropertyInfo)memberInfo);

                    entry.PropertyInfo = propInfo;

                    ValidatePersistable(propInfo, false, false, false, filter);

                    // Check the attribute on the property to see if it has a ContainerType
                    TemplateContainerAttribute templateAttrib = (TemplateContainerAttribute)Attribute.GetCustomAttribute(propInfo, typeof(TemplateContainerAttribute), false);

                    if (templateAttrib != null) {
                        if (!typeof(INamingContainer).IsAssignableFrom(templateAttrib.ContainerType)) {
                            throw new HttpException(SR.GetString(SR.Invalid_template_container, name, templateAttrib.ContainerType.FullName));
                        }

                        // If it had one, make sure the builder knows what type it is
                        builder.SetControlType(templateAttrib.ContainerType);
                    }

                    entry.Type = propInfo.PropertyType;
                }
                else {
                    Debug.Assert(memberInfo is FieldInfo);
                    memberType = ((FieldInfo)memberInfo).FieldType;
                }

                entry.Type = memberType;
            }
            else {
                throw new HttpException(SR.GetString(SR.Type_doesnt_have_property, _controlType.FullName, name));
            }

            // Add it to the template entries
            AddEntry(TemplatePropertyEntriesInternal, entry);
        }
 private void AddTemplateProperty(string filter, string name, TemplateBuilder builder)
 {
     string nameForCodeGen = string.Empty;
     MemberInfo info = PropertyMapper.GetMemberInfo(this._controlType, name, out nameForCodeGen);
     bool bindableTemplate = builder is BindableTemplateBuilder;
     TemplatePropertyEntry entry = new TemplatePropertyEntry(bindableTemplate) {
         Builder = builder,
         Filter = filter,
         Name = nameForCodeGen
     };
     Type fieldType = null;
     if (info == null)
     {
         throw new HttpException(System.Web.SR.GetString("Type_doesnt_have_property", new object[] { this._controlType.FullName, name }));
     }
     if (info is PropertyInfo)
     {
         PropertyInfo propInfo = (PropertyInfo) info;
         entry.PropertyInfo = propInfo;
         this.ValidatePersistable(propInfo, false, false, false, filter);
         TemplateContainerAttribute attribute = (TemplateContainerAttribute) Attribute.GetCustomAttribute(propInfo, typeof(TemplateContainerAttribute), false);
         if (attribute != null)
         {
             if (!typeof(INamingContainer).IsAssignableFrom(attribute.ContainerType))
             {
                 throw new HttpException(System.Web.SR.GetString("Invalid_template_container", new object[] { name, attribute.ContainerType.FullName }));
             }
             builder.SetControlType(attribute.ContainerType);
         }
         entry.Type = propInfo.PropertyType;
     }
     else
     {
         fieldType = ((FieldInfo) info).FieldType;
     }
     entry.Type = fieldType;
     this.AddEntry(this.TemplatePropertyEntriesInternal, entry);
 }