Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / System / Data / DataKey.cs / 1 / DataKey.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System; using System.Diagnostics; using System.ComponentModel; internal struct DataKey { internal const Int32 COLUMN = unchecked((int)0x0000FFFF); internal const Int32 DESCENDING = unchecked((int)0x80000000); private const int maxColumns = 32; private readonly DataColumn[] columns; ////// internal DataKey(DataColumn[] columns, bool copyColumns) { if (columns == null) throw ExceptionBuilder.ArgumentNull("columns"); if (columns.Length == 0) throw ExceptionBuilder.KeyNoColumns(); if (columns.Length > maxColumns) throw ExceptionBuilder.KeyTooManyColumns(maxColumns); for (int i = 0; i < columns.Length; i++) { if (columns[i] == null) throw ExceptionBuilder.ArgumentNull("column"); } for (int i = 0; i < columns.Length; i++) { for (int j = 0; j < i; j++) { if (columns[i] == columns[j]) { throw ExceptionBuilder.KeyDuplicateColumns(columns[i].ColumnName); } } } if (copyColumns) { // Need to make a copy of all columns this.columns = new DataColumn [columns.Length]; for (int i = 0; i < columns.Length; i++) this.columns[i] = columns[i]; } else { // take ownership of the array passed in this.columns = columns; } CheckState(); } internal DataColumn[] ColumnsReference { get { return columns; } } internal bool HasValue { get { return (null != columns); } } internal DataTable Table { get { return columns[0].Table; } } internal void CheckState() { DataTable table = columns[0].Table; if (table == null) { throw ExceptionBuilder.ColumnNotInAnyTable(); } for (int i = 1; i < columns.Length; i++) { if (columns[i].Table == null) { throw ExceptionBuilder.ColumnNotInAnyTable(); } if (columns[i].Table != table) { throw ExceptionBuilder.KeyTableMismatch(); } } } internal bool ColumnsEqual(DataKey key) { //check to see if this.columns && key2's columns are equal regardless of order DataColumn[] column1=columns; DataColumn[] column2=((DataKey)key).columns; if (column1 == column2) { return true; } else if (column1 == null || column2 == null) { return false; } else if (column1.Length != column2.Length) { return false; } else { int i, j; for (i=0; i[To be supplied.] ///// Copyright (c) Microsoft Corporation. All rights reserved. // // [....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System; using System.Diagnostics; using System.ComponentModel; internal struct DataKey { internal const Int32 COLUMN = unchecked((int)0x0000FFFF); internal const Int32 DESCENDING = unchecked((int)0x80000000); private const int maxColumns = 32; private readonly DataColumn[] columns; ////// internal DataKey(DataColumn[] columns, bool copyColumns) { if (columns == null) throw ExceptionBuilder.ArgumentNull("columns"); if (columns.Length == 0) throw ExceptionBuilder.KeyNoColumns(); if (columns.Length > maxColumns) throw ExceptionBuilder.KeyTooManyColumns(maxColumns); for (int i = 0; i < columns.Length; i++) { if (columns[i] == null) throw ExceptionBuilder.ArgumentNull("column"); } for (int i = 0; i < columns.Length; i++) { for (int j = 0; j < i; j++) { if (columns[i] == columns[j]) { throw ExceptionBuilder.KeyDuplicateColumns(columns[i].ColumnName); } } } if (copyColumns) { // Need to make a copy of all columns this.columns = new DataColumn [columns.Length]; for (int i = 0; i < columns.Length; i++) this.columns[i] = columns[i]; } else { // take ownership of the array passed in this.columns = columns; } CheckState(); } internal DataColumn[] ColumnsReference { get { return columns; } } internal bool HasValue { get { return (null != columns); } } internal DataTable Table { get { return columns[0].Table; } } internal void CheckState() { DataTable table = columns[0].Table; if (table == null) { throw ExceptionBuilder.ColumnNotInAnyTable(); } for (int i = 1; i < columns.Length; i++) { if (columns[i].Table == null) { throw ExceptionBuilder.ColumnNotInAnyTable(); } if (columns[i].Table != table) { throw ExceptionBuilder.KeyTableMismatch(); } } } internal bool ColumnsEqual(DataKey key) { //check to see if this.columns && key2's columns are equal regardless of order DataColumn[] column1=columns; DataColumn[] column2=((DataKey)key).columns; if (column1 == column2) { return true; } else if (column1 == null || column2 == null) { return false; } else if (column1.Length != column2.Length) { return false; } else { int i, j; for (i=0; i[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DecoratedNameAttribute.cs
- MulticastOption.cs
- FilterFactory.cs
- Claim.cs
- ListenerAdapterBase.cs
- _RequestCacheProtocol.cs
- odbcmetadatafactory.cs
- DataGridViewUtilities.cs
- DynamicPropertyReader.cs
- OrderByQueryOptionExpression.cs
- PatternMatcher.cs
- ProgressBarRenderer.cs
- BitmapDecoder.cs
- Monitor.cs
- _DisconnectOverlappedAsyncResult.cs
- DesignConnectionCollection.cs
- DocumentViewerConstants.cs
- BoundingRectTracker.cs
- FragmentQueryKB.cs
- MappingItemCollection.cs
- PersonalizationState.cs
- StringArrayConverter.cs
- XamlToRtfWriter.cs
- ToolStripCollectionEditor.cs
- SqlConnectionManager.cs
- RelationshipFixer.cs
- HtmlInputControl.cs
- SystemEvents.cs
- ImplicitInputBrush.cs
- AnnotationAuthorChangedEventArgs.cs
- HashStream.cs
- EventsTab.cs
- KeyedCollection.cs
- ScrollItemProviderWrapper.cs
- Debug.cs
- ComMethodElement.cs
- InputLanguageProfileNotifySink.cs
- ScrollBar.cs
- BuildProviderCollection.cs
- WinFormsUtils.cs
- QuaternionKeyFrameCollection.cs
- InputBuffer.cs
- ComplexPropertyEntry.cs
- CollectionViewGroupRoot.cs
- TreeViewItem.cs
- StandardRuntimeEnumValidatorAttribute.cs
- AttributeTable.cs
- ProcessThread.cs
- CodeSnippetTypeMember.cs
- CompilerWrapper.cs
- ImageSource.cs
- EmptyQuery.cs
- AQNBuilder.cs
- ListViewItemMouseHoverEvent.cs
- WindowsSlider.cs
- PipelineModuleStepContainer.cs
- CrossContextChannel.cs
- ClassHandlersStore.cs
- AttributeCollection.cs
- DataSpaceManager.cs
- FtpWebRequest.cs
- Journal.cs
- ZipIOCentralDirectoryFileHeader.cs
- StringBlob.cs
- MemoryStream.cs
- RadioButtonPopupAdapter.cs
- WindowsGraphics.cs
- SchemaMapping.cs
- DetailsViewInsertedEventArgs.cs
- MetadataArtifactLoader.cs
- EntityClassGenerator.cs
- Utils.cs
- Assert.cs
- SqlEnums.cs
- Bits.cs
- UserControlCodeDomTreeGenerator.cs
- ConfigurationSettings.cs
- SecurityIdentifierElement.cs
- WindowsTooltip.cs
- DataListItemCollection.cs
- GlyphRunDrawing.cs
- GreenMethods.cs
- SystemResourceHost.cs
- XamlRtfConverter.cs
- NetTcpSection.cs
- HtmlElement.cs
- BitmapImage.cs
- StyleTypedPropertyAttribute.cs
- IWorkflowDebuggerService.cs
- ReadOnlyDictionary.cs
- OleDbInfoMessageEvent.cs
- SyndicationItem.cs
- TemplateField.cs
- PersonalizablePropertyEntry.cs
- TableProvider.cs
- UserControl.cs
- CookielessHelper.cs
- LoginCancelEventArgs.cs
- UInt32.cs
- LocatorGroup.cs