Inheritance: System.ComponentModel.PropertyDescriptor
Ejemplo n.º 1
0
 public override bool Equals(object other)
 {
     if (other is DataColumnPropertyDescriptor)
     {
         DataColumnPropertyDescriptor descriptor = (DataColumnPropertyDescriptor)other;
         return(descriptor.Column == Column);
     }
     return(false);
 }
Ejemplo n.º 2
0
        public override bool Equals([NotNullWhen(true)] object?other)
        {
            if (other is DataColumnPropertyDescriptor)
            {
                DataColumnPropertyDescriptor descriptor = (DataColumnPropertyDescriptor)other;
                return(descriptor.Column == Column);
            }

            return(false);
        }
Ejemplo n.º 3
0
        PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor [] listAccessors)
        {
            if (dataTable == null)
            {
                return(new PropertyDescriptorCollection(new PropertyDescriptor [0]));
            }

            // FIXME: use listAccessors somehow
            PropertyDescriptor [] descriptors =
                new PropertyDescriptor [dataTable.Columns.Count + dataTable.ChildRelations.Count];

            int d = 0;

            for (int col = 0; col < dataTable.Columns.Count; col++)
            {
                DataColumn dataColumn = dataTable.Columns[col];
                DataColumnPropertyDescriptor descriptor;

                descriptor = new DataColumnPropertyDescriptor(dataColumn.ColumnName, col, null);
                descriptor.SetComponentType(typeof(System.Data.DataRowView));
                descriptor.SetPropertyType(dataColumn.DataType);
                descriptor.SetReadOnly(dataColumn.ReadOnly);
                descriptor.SetBrowsable(dataColumn.ColumnMapping != MappingType.Hidden);
                descriptors [d++] = descriptor;
            }
            for (int rel = 0; rel < dataTable.ChildRelations.Count; rel++)
            {
                DataRelation dataRelation = dataTable.ChildRelations [rel];
                DataRelationPropertyDescriptor descriptor;

                descriptor        = new DataRelationPropertyDescriptor(dataRelation);
                descriptors [d++] = descriptor;
            }

            return(new PropertyDescriptorCollection(descriptors));
        }
Ejemplo n.º 4
0
 /// <devdoc>
 ///     Retrieves an array of properties that the given component instance
 ///     provides.  This may differ from the set of properties the class
 ///     provides.  If the component is sited, the site may add or remove
 ///     additional properties.  The returned array of properties will be
 ///     filtered by the given set of attributes.
 /// </devdoc>
 internal PropertyDescriptorCollection GetPropertyDescriptorCollection(Attribute[] attributes) {
     if (propertyDescriptorCollectionCache == null) {
         int columnsCount   = Columns.Count;
         int relationsCount = ChildRelations.Count;
         PropertyDescriptor[] props = new PropertyDescriptor[columnsCount + relationsCount]; {
             for (int i = 0; i < columnsCount; i++) {
                 props[i] = new DataColumnPropertyDescriptor(Columns[i]);
             }
             for (int i = 0; i < relationsCount; i++) {
                 props[columnsCount + i] = new DataRelationPropertyDescriptor(ChildRelations[i]);
             }
         }
         propertyDescriptorCollectionCache = new PropertyDescriptorCollection(props);
     }
     return propertyDescriptorCollectionCache;
 }
Ejemplo n.º 5
0
		private void UpdatePropertyDescriptorsCache ()
		{
			PropertyDescriptor[] descriptors = new PropertyDescriptor[Columns.Count + ChildRelations.Count];
			int index = 0;
			foreach (DataColumn col in Columns)
				descriptors [index++] = new DataColumnPropertyDescriptor (col);

			foreach (DataRelation rel in ChildRelations)
				descriptors [index++] = new DataRelationPropertyDescriptor (rel);

			_propertyDescriptorsCache = new PropertyDescriptorCollection (descriptors);
		}
Ejemplo n.º 6
0
		PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor[] listAccessors) 
		{
			// FIXME: use listAccessors somehow
			DataColumnPropertyDescriptor [] descriptors = 
				new DataColumnPropertyDescriptor [dataTable.Columns.Count];

			DataColumnPropertyDescriptor descriptor;
			DataColumn dataColumn;
			for (int col = 0; col < dataTable.Columns.Count; col ++) {
				dataColumn = dataTable.Columns[col];
				descriptor = new DataColumnPropertyDescriptor(
					dataColumn.ColumnName, col, null);
				descriptor.SetComponentType (typeof (System.Data.DataRowView));
				descriptor.SetPropertyType (dataColumn.DataType);
				descriptor.SetReadOnly (dataColumn.ReadOnly);
				descriptors [col] = descriptor;
			}
			return new PropertyDescriptorCollection (descriptors);
		}
Ejemplo n.º 7
0
		PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor [] listAccessors)
		{
			if (dataTable == null)
				return new PropertyDescriptorCollection (new PropertyDescriptor [0]);

			// FIXME: use listAccessors somehow
			PropertyDescriptor [] descriptors =
				new PropertyDescriptor [dataTable.Columns.Count + dataTable.ChildRelations.Count];

			int d = 0;
			for (int col = 0; col < dataTable.Columns.Count; col ++) {
				DataColumn dataColumn = dataTable.Columns[col];
				DataColumnPropertyDescriptor descriptor;

				descriptor = new DataColumnPropertyDescriptor (dataColumn.ColumnName, col, null);
				descriptor.SetComponentType (typeof (System.Data.DataRowView));
				descriptor.SetPropertyType (dataColumn.DataType);
				descriptor.SetReadOnly (dataColumn.ReadOnly);
				descriptor.SetBrowsable (dataColumn.ColumnMapping != MappingType.Hidden);
				descriptors [d++] = descriptor;
			}
			for (int rel = 0; rel < dataTable.ChildRelations.Count; rel ++) {
				DataRelation dataRelation = dataTable.ChildRelations [rel];
				DataRelationPropertyDescriptor descriptor;

				descriptor = new DataRelationPropertyDescriptor (dataRelation);
				descriptors [d++] = descriptor;
			}

			return new PropertyDescriptorCollection (descriptors);
		}
Ejemplo n.º 8
0
		PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
		{
			DataColumnPropertyDescriptor[] descriptors = 
				new DataColumnPropertyDescriptor [FieldCount];

			DataColumnPropertyDescriptor descriptor;
			for (int col = 0; col < FieldCount; col++) {
				descriptor = new DataColumnPropertyDescriptor(
					GetName (col), col, null);
				descriptor.SetComponentType (typeof (DbDataRecord));
				descriptor.SetPropertyType (GetFieldType (col));
				descriptors [col] = descriptor;
			}

			return new PropertyDescriptorCollection (descriptors);
		}
 internal PropertyDescriptorCollection GetPropertyDescriptorCollection(Attribute[] attributes)
 {
     if (this.propertyDescriptorCollectionCache == null)
     {
         int count = this.Columns.Count;
         int num4 = this.ChildRelations.Count;
         PropertyDescriptor[] properties = new PropertyDescriptor[count + num4];
         for (int i = 0; i < count; i++)
         {
             properties[i] = new DataColumnPropertyDescriptor(this.Columns[i]);
         }
         for (int j = 0; j < num4; j++)
         {
             properties[count + j] = new DataRelationPropertyDescriptor(this.ChildRelations[j]);
         }
         this.propertyDescriptorCollectionCache = new PropertyDescriptorCollection(properties);
     }
     return this.propertyDescriptorCollectionCache;
 }