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
- AuthStoreRoleProvider.cs
- WindowsScroll.cs
- TextParagraph.cs
- FormatterConverter.cs
- HelpOperationInvoker.cs
- FlowDocumentView.cs
- CatalogZone.cs
- translator.cs
- BindingCollection.cs
- KeyedByTypeCollection.cs
- CompilationUtil.cs
- NullReferenceException.cs
- TimelineClockCollection.cs
- AstTree.cs
- ReadOnlyNameValueCollection.cs
- SizeAnimationClockResource.cs
- SafeCryptContextHandle.cs
- SchemaCollectionPreprocessor.cs
- IPEndPoint.cs
- RadioButtonStandardAdapter.cs
- AnnotationDocumentPaginator.cs
- SelectionPattern.cs
- ScrollEvent.cs
- TextSchema.cs
- NativeMethods.cs
- SimpleWorkerRequest.cs
- WebPartsPersonalization.cs
- DecimalConstantAttribute.cs
- EdmMember.cs
- NumericUpDownAcceleration.cs
- TraceContextRecord.cs
- LinkButton.cs
- DispatcherOperation.cs
- CultureSpecificStringDictionary.cs
- PersistChildrenAttribute.cs
- XmlReader.cs
- ClientFormsIdentity.cs
- ADRoleFactoryConfiguration.cs
- _SslStream.cs
- TextDocumentView.cs
- XamlClipboardData.cs
- XmlSchemaCompilationSettings.cs
- AuthenticationException.cs
- BitmapInitialize.cs
- InstanceStore.cs
- ExtendedPropertyCollection.cs
- _IPv4Address.cs
- UnsafeNativeMethods.cs
- GeometryHitTestResult.cs
- TextServicesLoader.cs
- StreamReader.cs
- TraceHandler.cs
- ResizeGrip.cs
- XpsInterleavingPolicy.cs
- InstanceCreationEditor.cs
- SelectionUIService.cs
- DataTableTypeConverter.cs
- Cursors.cs
- ADMembershipProvider.cs
- WebPartCloseVerb.cs
- TokenBasedSetEnumerator.cs
- RawStylusSystemGestureInputReport.cs
- RadioButtonList.cs
- Renderer.cs
- DebugInfo.cs
- AdapterSwitches.cs
- RoutedEventConverter.cs
- Profiler.cs
- Types.cs
- XMLUtil.cs
- CustomSignedXml.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- MouseBinding.cs
- CornerRadius.cs
- Attachment.cs
- SafeViewOfFileHandle.cs
- PathSegmentCollection.cs
- MemberHolder.cs
- TableLayoutColumnStyleCollection.cs
- DataControlCommands.cs
- RoleGroupCollection.cs
- securitycriticaldataClass.cs
- BinaryConverter.cs
- ConfigurationPropertyAttribute.cs
- CollectionContainer.cs
- InkPresenterAutomationPeer.cs
- PropertyMetadata.cs
- StateManagedCollection.cs
- InvalidAsynchronousStateException.cs
- HyperlinkAutomationPeer.cs
- CodeMemberEvent.cs
- TwoPhaseCommitProxy.cs
- DragEvent.cs
- PersonalizationAdministration.cs
- UniqueIdentifierService.cs
- NameValuePermission.cs
- WhitespaceRule.cs
- JulianCalendar.cs
- HtmlTableCell.cs
- IPipelineRuntime.cs