Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SmiRecordBuffer.cs
- GenericEnumConverter.cs
- DnsPermission.cs
- hresults.cs
- QilTernary.cs
- XmlWrappingWriter.cs
- HandleCollector.cs
- DocumentXmlWriter.cs
- IERequestCache.cs
- TopClause.cs
- TypeTypeConverter.cs
- XmlNodeReader.cs
- LicenseProviderAttribute.cs
- SendKeys.cs
- JournalEntry.cs
- Rect3D.cs
- Number.cs
- EventlogProvider.cs
- WebDisplayNameAttribute.cs
- NavigationHelper.cs
- ViewBase.cs
- SoapProtocolImporter.cs
- IsolatedStorageFilePermission.cs
- DynamicILGenerator.cs
- Page.cs
- SourceInterpreter.cs
- GroupQuery.cs
- InputEventArgs.cs
- DependencyPropertyConverter.cs
- MimeTextImporter.cs
- RewritingPass.cs
- SessionEndedEventArgs.cs
- GeometryCollection.cs
- DockPatternIdentifiers.cs
- SspiNegotiationTokenProvider.cs
- DateTimeParse.cs
- HyperLink.cs
- ExceptionValidationRule.cs
- ListViewInsertEventArgs.cs
- RoleService.cs
- WebHttpBinding.cs
- ConstantProjectedSlot.cs
- UnitySerializationHolder.cs
- PackUriHelper.cs
- TableLayoutCellPaintEventArgs.cs
- ControlParameter.cs
- XhtmlBasicValidationSummaryAdapter.cs
- dsa.cs
- Ports.cs
- TdsValueSetter.cs
- InputLanguageProfileNotifySink.cs
- ExceptionUtil.cs
- TreeIterators.cs
- CacheMode.cs
- BinaryFormatter.cs
- WmlControlAdapter.cs
- TreeNode.cs
- ScrollEventArgs.cs
- GregorianCalendarHelper.cs
- XmlDictionaryReaderQuotas.cs
- InternalRelationshipCollection.cs
- RolePrincipal.cs
- BitmapSourceSafeMILHandle.cs
- DataStreamFromComStream.cs
- BeginSelectCardRequest.cs
- RouteItem.cs
- SettingsPropertyWrongTypeException.cs
- BrowserCapabilitiesFactoryBase.cs
- ExpressionNormalizer.cs
- PreservationFileReader.cs
- UpnEndpointIdentityExtension.cs
- Exception.cs
- CompiledQueryCacheKey.cs
- EmbossBitmapEffect.cs
- TranslateTransform3D.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- PlaceHolder.cs
- TTSVoice.cs
- GridViewUpdatedEventArgs.cs
- TextViewBase.cs
- AuthenticationConfig.cs
- EdgeModeValidation.cs
- VisualStyleElement.cs
- ConfigXmlAttribute.cs
- IndentTextWriter.cs
- ModuleElement.cs
- AuthenticatingEventArgs.cs
- UserControl.cs
- HtmlEmptyTagControlBuilder.cs
- ErrorFormatter.cs
- DiscreteKeyFrames.cs
- BitmapEffectState.cs
- XmlSchemaSimpleTypeUnion.cs
- ToolStripPanelCell.cs
- HighlightComponent.cs
- RawStylusSystemGestureInputReport.cs
- CommandPlan.cs
- CachedFontFamily.cs
- GeneratedContractType.cs
- WebConfigurationFileMap.cs