コード例 #1
0
        /// <devdoc>
        /// </devdoc>
        private void AddComplexProperty(string filter, string name, ControlBuilder builder) {

            // VSWhidbey 281887 Do not ignore complex properties, since templates could be defined inside collections
            // , databinding or code can be placed inside templates.
            /*
            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);

            // Initialize the entry
            ComplexPropertyEntry entry = new ComplexPropertyEntry();

            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;
                    if (propInfo.GetSetMethod() == null) {
                        entry.ReadOnly = true;
                    }

                    // Check if the property is themeable and persistable
                    ValidatePersistable(propInfo, false, false, false, filter);
                    memberType = 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 the entry to the complex entries
            AddEntry(ComplexPropertyEntriesInternal, entry);
        }
コード例 #2
0
 private void AddComplexProperty(string filter, string name, ControlBuilder builder)
 {
     string nameForCodeGen = string.Empty;
     MemberInfo info = PropertyMapper.GetMemberInfo(this._controlType, name, out nameForCodeGen);
     ComplexPropertyEntry entry = new ComplexPropertyEntry {
         Builder = builder,
         Filter = filter,
         Name = nameForCodeGen
     };
     Type propertyType = 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;
         if (propInfo.GetSetMethod() == null)
         {
             entry.ReadOnly = true;
         }
         this.ValidatePersistable(propInfo, false, false, false, filter);
         propertyType = propInfo.PropertyType;
     }
     else
     {
         propertyType = ((FieldInfo) info).FieldType;
     }
     entry.Type = propertyType;
     this.AddEntry(this.ComplexPropertyEntriesInternal, entry);
 }
コード例 #3
0
        /// <devdoc>
        /// </devdoc>
        private void AddCollectionItem(ControlBuilder builder) {
            // Just save the builder and filter and add it to the complex entries
            ComplexPropertyEntry entry = new ComplexPropertyEntry(true);

            entry.Builder = builder;
            entry.Filter = String.Empty;
            AddEntry(ComplexPropertyEntriesInternal, entry);
        }
コード例 #4
0
 private void AddCollectionItem(ControlBuilder builder)
 {
     ComplexPropertyEntry entry = new ComplexPropertyEntry(true) {
         Builder = builder,
         Filter = string.Empty
     };
     this.AddEntry(this.ComplexPropertyEntriesInternal, entry);
 }