Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / DataColumnPropertyDescriptor.cs / 1 / DataColumnPropertyDescriptor.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System.Diagnostics; using System.ComponentModel; using System.Data.Common; internal sealed class DataColumnPropertyDescriptor : PropertyDescriptor { DataColumn column; internal DataColumnPropertyDescriptor(DataColumn dataColumn) : base(dataColumn.ColumnName, null) { this.column = dataColumn; } public override AttributeCollection Attributes { get { if (typeof(System.Collections.IList).IsAssignableFrom(this.PropertyType)) { Attribute[] attrs = new Attribute[base.Attributes.Count + 1]; base.Attributes.CopyTo(attrs, 0); // we don't want to show the columns which are of type IList in the designer attrs[attrs.Length - 1] = new ListBindableAttribute(false); return new AttributeCollection(attrs); } else { return base.Attributes; } } } internal DataColumn Column { get { return column; } } public override Type ComponentType { get { return typeof(DataRowView); } } public override bool IsReadOnly { get { return column.ReadOnly; } } public override Type PropertyType { get { return column.DataType; } } public override bool Equals(object other) { if (other is DataColumnPropertyDescriptor) { DataColumnPropertyDescriptor descriptor = (DataColumnPropertyDescriptor) other; return(descriptor.Column == Column); } return false; } public override Int32 GetHashCode() { return Column.GetHashCode(); } public override bool CanResetValue(object component) { DataRowView dataRowView = (DataRowView) component; if (!column.IsSqlType) return (dataRowView.GetColumnValue(column) != DBNull.Value); return (!DataStorage.IsObjectNull(dataRowView.GetColumnValue(column))); } public override object GetValue(object component) { DataRowView dataRowView = (DataRowView) component; return dataRowView.GetColumnValue(column); } public override void ResetValue(object component) { DataRowView dataRowView = (DataRowView) component; dataRowView.SetColumnValue(column, DBNull.Value);// no need to ccheck for the col type and set Sql...Null! } public override void SetValue(object component, object value) { DataRowView dataRowView = (DataRowView) component; dataRowView.SetColumnValue(column, value); OnValueChanged(component, EventArgs.Empty); } public override bool ShouldSerializeValue(object component) { return false; } public override bool IsBrowsable { get { return (column.ColumnMapping == System.Data.MappingType.Hidden ? false : base.IsBrowsable); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System.Diagnostics; using System.ComponentModel; using System.Data.Common; internal sealed class DataColumnPropertyDescriptor : PropertyDescriptor { DataColumn column; internal DataColumnPropertyDescriptor(DataColumn dataColumn) : base(dataColumn.ColumnName, null) { this.column = dataColumn; } public override AttributeCollection Attributes { get { if (typeof(System.Collections.IList).IsAssignableFrom(this.PropertyType)) { Attribute[] attrs = new Attribute[base.Attributes.Count + 1]; base.Attributes.CopyTo(attrs, 0); // we don't want to show the columns which are of type IList in the designer attrs[attrs.Length - 1] = new ListBindableAttribute(false); return new AttributeCollection(attrs); } else { return base.Attributes; } } } internal DataColumn Column { get { return column; } } public override Type ComponentType { get { return typeof(DataRowView); } } public override bool IsReadOnly { get { return column.ReadOnly; } } public override Type PropertyType { get { return column.DataType; } } public override bool Equals(object other) { if (other is DataColumnPropertyDescriptor) { DataColumnPropertyDescriptor descriptor = (DataColumnPropertyDescriptor) other; return(descriptor.Column == Column); } return false; } public override Int32 GetHashCode() { return Column.GetHashCode(); } public override bool CanResetValue(object component) { DataRowView dataRowView = (DataRowView) component; if (!column.IsSqlType) return (dataRowView.GetColumnValue(column) != DBNull.Value); return (!DataStorage.IsObjectNull(dataRowView.GetColumnValue(column))); } public override object GetValue(object component) { DataRowView dataRowView = (DataRowView) component; return dataRowView.GetColumnValue(column); } public override void ResetValue(object component) { DataRowView dataRowView = (DataRowView) component; dataRowView.SetColumnValue(column, DBNull.Value);// no need to ccheck for the col type and set Sql...Null! } public override void SetValue(object component, object value) { DataRowView dataRowView = (DataRowView) component; dataRowView.SetColumnValue(column, value); OnValueChanged(component, EventArgs.Empty); } public override bool ShouldSerializeValue(object component) { return false; } public override bool IsBrowsable { get { return (column.ColumnMapping == System.Data.MappingType.Hidden ? false : base.IsBrowsable); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TemplateControl.cs
- QueryOperationResponseOfT.cs
- SmiRequestExecutor.cs
- CompositeControl.cs
- PrintDialog.cs
- RedistVersionInfo.cs
- PaintValueEventArgs.cs
- NumberEdit.cs
- SqlDependencyUtils.cs
- ValidationPropertyAttribute.cs
- IisTraceListener.cs
- ModuleBuilderData.cs
- XmlILOptimizerVisitor.cs
- WebPartDisplayModeCollection.cs
- CrossContextChannel.cs
- ListViewInsertEventArgs.cs
- GridViewItemAutomationPeer.cs
- WorkflowTraceTransfer.cs
- SmiEventSink_Default.cs
- SqlDataSourceCommandEventArgs.cs
- PackUriHelper.cs
- ComplexBindingPropertiesAttribute.cs
- WpfXamlType.cs
- LayoutInformation.cs
- RowToParametersTransformer.cs
- TraceHandler.cs
- BinaryHeap.cs
- SerialPort.cs
- ObjectDataSourceDisposingEventArgs.cs
- xdrvalidator.cs
- AuthStoreRoleProvider.cs
- InkCanvasAutomationPeer.cs
- _HTTPDateParse.cs
- RepeaterItemCollection.cs
- Clause.cs
- Parser.cs
- PerformanceCounterPermissionEntryCollection.cs
- HandleCollector.cs
- InfoCardArgumentException.cs
- HttpException.cs
- PropertyReferenceSerializer.cs
- TraceSection.cs
- FormsAuthenticationCredentials.cs
- Documentation.cs
- BasePattern.cs
- SqlDataSourceStatusEventArgs.cs
- MbpInfo.cs
- GZipDecoder.cs
- SqlTypeSystemProvider.cs
- ImageDesigner.cs
- ConnectionPoint.cs
- WsatAdminException.cs
- FontFamilyConverter.cs
- XhtmlBasicImageAdapter.cs
- SchemaElementLookUpTable.cs
- NonClientArea.cs
- DrawingContextDrawingContextWalker.cs
- ColumnHeaderConverter.cs
- wgx_sdk_version.cs
- RotateTransform3D.cs
- Inline.cs
- Imaging.cs
- processwaithandle.cs
- ErrorProvider.cs
- Int32Rect.cs
- SqlCaseSimplifier.cs
- DropDownButton.cs
- HttpModuleCollection.cs
- ConfigXmlSignificantWhitespace.cs
- AesCryptoServiceProvider.cs
- StrokeNodeData.cs
- SingleConverter.cs
- SpellerError.cs
- KeyPullup.cs
- DataListItem.cs
- BatchStream.cs
- PersonalizationState.cs
- SqlNodeAnnotations.cs
- BinHexDecoder.cs
- HtmlInputText.cs
- SynchronizingStream.cs
- PointHitTestResult.cs
- Membership.cs
- DrawingServices.cs
- ForwardPositionQuery.cs
- DbMetaDataFactory.cs
- CodeGotoStatement.cs
- SpellerStatusTable.cs
- RouteItem.cs
- ButtonBase.cs
- Component.cs
- ExtenderProvidedPropertyAttribute.cs
- AuthenticationManager.cs
- NamespaceInfo.cs
- DataTable.cs
- SymbolTable.cs
- TextSpan.cs
- SqlComparer.cs
- TriggerCollection.cs
- SynchronizationLockException.cs