Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XsltArgumentList.cs
- WindowHelperService.cs
- HwndMouseInputProvider.cs
- BoolExpression.cs
- NativeMethods.cs
- TdsParserStaticMethods.cs
- PasswordRecoveryDesigner.cs
- InterleavedZipPartStream.cs
- MemoryRecordBuffer.cs
- XpsS0ValidatingLoader.cs
- AnonymousIdentificationModule.cs
- InvokeMethod.cs
- DecimalStorage.cs
- ObjectQuery_EntitySqlExtensions.cs
- GridViewCommandEventArgs.cs
- AttributeParameterInfo.cs
- DBSchemaRow.cs
- CLRBindingWorker.cs
- FormViewModeEventArgs.cs
- DrawListViewItemEventArgs.cs
- SafeLibraryHandle.cs
- EventWaitHandle.cs
- HandledEventArgs.cs
- Table.cs
- FixedFlowMap.cs
- WorkflowMarkupSerializer.cs
- adornercollection.cs
- LineServicesCallbacks.cs
- LinqDataSourceSelectEventArgs.cs
- WindowsButton.cs
- DataBinder.cs
- SortedDictionary.cs
- EntityStoreSchemaFilterEntry.cs
- CodeIndexerExpression.cs
- DataTablePropertyDescriptor.cs
- ConnectorSelectionGlyph.cs
- HwndTarget.cs
- XmlSchemaParticle.cs
- PathSegment.cs
- TaskHelper.cs
- UnaryExpression.cs
- DataGridViewSelectedRowCollection.cs
- ExpandCollapsePattern.cs
- ProcessThread.cs
- DefaultCommandExtensionCallback.cs
- ComplexType.cs
- UIElementCollection.cs
- EmulateRecognizeCompletedEventArgs.cs
- TimelineCollection.cs
- UpdatePanelTrigger.cs
- UnknownWrapper.cs
- srgsitem.cs
- PointLightBase.cs
- HintTextMaxWidthConverter.cs
- SafeCoTaskMem.cs
- COM2ColorConverter.cs
- DataSourceControlBuilder.cs
- SoapReflectionImporter.cs
- BindingRestrictions.cs
- FacetValueContainer.cs
- ContainerUIElement3D.cs
- QilIterator.cs
- SAPIEngineTypes.cs
- AudioFormatConverter.cs
- IntellisenseTextBox.cs
- Classification.cs
- BuildProvider.cs
- ScrollPattern.cs
- SetIterators.cs
- SamlAssertion.cs
- MissingFieldException.cs
- ValidatingReaderNodeData.cs
- BindingWorker.cs
- MarkupProperty.cs
- ControlEvent.cs
- ReadOnlyHierarchicalDataSourceView.cs
- InvalidateEvent.cs
- xmlsaver.cs
- SqlGatherProducedAliases.cs
- Ops.cs
- DbCommandDefinition.cs
- LocatorBase.cs
- GridViewPageEventArgs.cs
- TypeNameParser.cs
- ClientUtils.cs
- Site.cs
- _Rfc2616CacheValidators.cs
- UIElementIsland.cs
- AuthenticatedStream.cs
- SchemaInfo.cs
- Itemizer.cs
- TextEditorSelection.cs
- SettingsBase.cs
- NativeMethods.cs
- CapabilitiesPattern.cs
- IdentityHolder.cs
- DataGridRow.cs
- SectionInformation.cs
- SqlAggregateChecker.cs
- ElementAction.cs