Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Data / System / Data / RelatedView.cs / 3 / RelatedView.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System; using System.Diagnostics; internal sealed class RelatedView : DataView, IFilter { private readonly DataKey key; private object[] values; public RelatedView(DataColumn[] columns, object[] values) : base(columns[0].Table, false) { if (values == null) { throw ExceptionBuilder.ArgumentNull("values"); } this.key = new DataKey(columns, true); this.values = values; Debug.Assert (this.Table == key.Table, "Key.Table Must be equal to Current Table"); base.ResetRowViewCache(); } public bool Invoke(DataRow row, DataRowVersion version) { object[] keyValues = row.GetKeyValues(key, version); #if false for (int i = 0; i < keyValues.Length; i++) { Debug.WriteLine("keyvalues[" + (i).ToString() + "] = " + Convert.ToString(keyValues[i])); } for (int i = 0; i < values.Length; i++) { Debug.WriteLine("values[" + (i).ToString() + "] = " + Convert.ToString(values[i])); } #endif bool allow = true; if (keyValues.Length != values.Length) { allow = false; } else { for (int i = 0; i < keyValues.Length; i++) { if (!keyValues[i].Equals(values[i])) { allow = false; break; } } } IFilter baseFilter = base.GetFilter(); if (baseFilter != null) allow &= baseFilter.Invoke(row, version); return allow; } internal override IFilter GetFilter() { return this; } // move to OnModeChanged public override DataRowView AddNew() { DataRowView addNewRowView = base.AddNew(); addNewRowView.Row.SetKeyValues(key, values); return addNewRowView; } internal override void SetIndex(string newSort, DataViewRowState newRowStates, IFilter newRowFilter) { SetIndex2(newSort, newRowStates, newRowFilter, false); Reset(); } public override bool Equals( DataView dv) { if (dv is RelatedView == false) return false; if (!base.Equals(dv)) return false; return (CompareArray(this.key.ColumnsReference, ((RelatedView)dv).key.ColumnsReference) ||CompareArray(this.values, ((RelatedView)dv).values)); } private bool CompareArray(object[] value1, object[] value2) { if (value1.Length != value2.Length) return false; for(int i = 0; i < value1.Length; i++) { if (value1[i] != value2[i]) return false; } return true; } } } // 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
- CompiledIdentityConstraint.cs
- CallbackTimeoutsBehavior.cs
- ICollection.cs
- GridSplitter.cs
- BufferModesCollection.cs
- Run.cs
- MarkedHighlightComponent.cs
- ReferentialConstraintRoleElement.cs
- UnsafeNativeMethods.cs
- SafeLibraryHandle.cs
- PhysicalAddress.cs
- MissingSatelliteAssemblyException.cs
- InstancePersistence.cs
- ObjectAssociationEndMapping.cs
- ImageAttributes.cs
- WebScriptEnablingElement.cs
- WsdlImporter.cs
- FontDriver.cs
- XmlCharCheckingReader.cs
- EntityObject.cs
- InvokeBinder.cs
- InternalTypeHelper.cs
- ToolStripDropDownItem.cs
- WebZoneDesigner.cs
- RemotingConfigParser.cs
- ExpressionBindingCollection.cs
- TextEndOfLine.cs
- CellParagraph.cs
- X509ChainPolicy.cs
- SerializerDescriptor.cs
- CodeVariableDeclarationStatement.cs
- ECDiffieHellman.cs
- TemplateEditingVerb.cs
- EdmFunctions.cs
- HostProtectionPermission.cs
- login.cs
- Wrapper.cs
- RoleServiceManager.cs
- RpcCryptoContext.cs
- Command.cs
- ParameterReplacerVisitor.cs
- NameGenerator.cs
- mactripleDES.cs
- TableAdapterManagerHelper.cs
- PeerContact.cs
- PeerToPeerException.cs
- DataServiceBehavior.cs
- RuntimeTrackingProfile.cs
- DetailsViewAutoFormat.cs
- AnnotationResourceCollection.cs
- WebPartUtil.cs
- SecurityTokenAuthenticator.cs
- SessionStateModule.cs
- VisualStyleElement.cs
- QilExpression.cs
- EditorPartChrome.cs
- ListViewItemCollectionEditor.cs
- JoinElimination.cs
- QilExpression.cs
- DataControlImageButton.cs
- ViewBox.cs
- Marshal.cs
- ListViewHitTestInfo.cs
- HMACSHA1.cs
- WebPartVerbCollection.cs
- WorkItem.cs
- AuthenticationService.cs
- DesignerVerbCollection.cs
- SafeArrayTypeMismatchException.cs
- RoutedCommand.cs
- BooleanToVisibilityConverter.cs
- Sql8ExpressionRewriter.cs
- ScriptServiceAttribute.cs
- NativeMethods.cs
- VerticalAlignConverter.cs
- ChildrenQuery.cs
- UnsafeNativeMethods.cs
- ValidatorCollection.cs
- OdbcConnectionPoolProviderInfo.cs
- DragSelectionMessageFilter.cs
- DetailsViewRow.cs
- RoleManagerEventArgs.cs
- RequestResizeEvent.cs
- TrackingExtract.cs
- Validator.cs
- ImageFormatConverter.cs
- SimpleType.cs
- XmlSchemaException.cs
- AdRotatorDesigner.cs
- GroupLabel.cs
- ImageClickEventArgs.cs
- WebControlsSection.cs
- SqlClientWrapperSmiStreamChars.cs
- MessageEncodingBindingElement.cs
- ShapingEngine.cs
- CodeCastExpression.cs
- TextDecorations.cs
- FieldAccessException.cs
- Axis.cs
- DictionarySectionHandler.cs