Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Data / System / Data / Filter / LookupNode.cs / 3 / LookupNode.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System; using System.ComponentModel; using System.Collections.Generic; using System.Diagnostics; internal sealed class LookupNode : ExpressionNode { private readonly string relationName; // can be null private readonly string columnName; private DataColumn column; private DataRelation relation; internal LookupNode(DataTable table, string columnName, string relationName) : base(table) { this.relationName = relationName; this.columnName = columnName; } internal override void Bind(DataTable table, Listlist) { BindTable(table); column = null; // clear for rebinding (if original binding was valid) relation = null; if (table == null) throw ExprException.ExpressionUnbound(this.ToString()); // First find parent table DataRelationCollection relations; relations = table.ParentRelations; if (relationName == null) { // must have one and only one relation if (relations.Count > 1) { throw ExprException.UnresolvedRelation(table.TableName, this.ToString()); } relation = relations[0]; } else { relation = relations[relationName]; } if (null == relation) { throw ExprException.BindFailure(relationName);// WebData 112162: this operation is not clne specific, throw generic exception } DataTable parentTable = relation.ParentTable; Debug.Assert(relation != null, "Invalid relation: no parent table."); Debug.Assert(columnName != null, "All Lookup expressions have columnName set."); this.column = parentTable.Columns[columnName]; if (column == null) throw ExprException.UnboundName(columnName); // add column to the dependency list int i; for (i = 0; i < list.Count; i++) { // walk the list, check if the current column already on the list DataColumn dataColumn = list[i]; if (column == dataColumn) { break; } } if (i >= list.Count) { list.Add(column); } // AggregateNode.Bind(relation, list); } internal override object Eval() { throw ExprException.EvalNoContext(); } internal override object Eval(DataRow row, DataRowVersion version) { if (column == null || relation == null) throw ExprException.ExpressionUnbound(this.ToString()); DataRow parent = row.GetParentRow(relation, version); if (parent == null) return DBNull.Value; return parent[column, parent.HasVersion(version) ? version : DataRowVersion.Current]; // [....] : Bug 76154 } internal override object Eval(int[] recordNos) { throw ExprException.ComputeNotAggregate(this.ToString()); } internal override bool IsConstant() { return false; } internal override bool IsTableConstant() { return false; } internal override bool HasLocalAggregate() { return false; } internal override bool HasRemoteAggregate() { return false; } internal override bool DependsOn(DataColumn column) { if (this.column == column) { return true; } return false; } internal override ExpressionNode Optimize() { return this; } } } // 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
- EditorOptionAttribute.cs
- BamlTreeMap.cs
- SafeRightsManagementPubHandle.cs
- CodeIndexerExpression.cs
- SspiSafeHandles.cs
- AxisAngleRotation3D.cs
- PaperSource.cs
- ValueTypeFieldReference.cs
- LinqDataSourceEditData.cs
- DockAndAnchorLayout.cs
- RealProxy.cs
- BitmapScalingModeValidation.cs
- Queue.cs
- RankException.cs
- PlatformCulture.cs
- TraceHandler.cs
- PrintDocument.cs
- DateTimeFormat.cs
- HashAlgorithm.cs
- GZipUtils.cs
- GlyphInfoList.cs
- OracleParameter.cs
- CancellationState.cs
- TemplateControl.cs
- Profiler.cs
- TokenizerHelper.cs
- ThemeConfigurationDialog.cs
- GradientStop.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- SqlCacheDependencySection.cs
- FlowLayout.cs
- PopupRoot.cs
- QilLoop.cs
- LinkTarget.cs
- Vector3DKeyFrameCollection.cs
- StylusButtonCollection.cs
- Subordinate.cs
- HwndProxyElementProvider.cs
- Panel.cs
- Funcletizer.cs
- StretchValidation.cs
- ExecutedRoutedEventArgs.cs
- MultiView.cs
- ObjRef.cs
- DefaultProxySection.cs
- SolidBrush.cs
- DynamicRenderer.cs
- Misc.cs
- ResourceBinder.cs
- SimpleFileLog.cs
- ChangeInterceptorAttribute.cs
- ObfuscationAttribute.cs
- RankException.cs
- DisableDpiAwarenessAttribute.cs
- QuaternionRotation3D.cs
- NamespaceExpr.cs
- HandleExceptionArgs.cs
- KerberosSecurityTokenParameters.cs
- DataRowCollection.cs
- Clause.cs
- ToolBarOverflowPanel.cs
- NativeCompoundFileAPIs.cs
- WindowsFont.cs
- LicenseProviderAttribute.cs
- DSASignatureDeformatter.cs
- ColorInterpolationModeValidation.cs
- DynamicHyperLink.cs
- NumberSubstitution.cs
- TemplatePropertyEntry.cs
- WebPartEditVerb.cs
- _PooledStream.cs
- InvalidCastException.cs
- Currency.cs
- DrawingVisual.cs
- serverconfig.cs
- FacetChecker.cs
- PrimitiveSchema.cs
- WebPartConnectionsCancelEventArgs.cs
- ReadOnlyMetadataCollection.cs
- XamlReaderHelper.cs
- IdnMapping.cs
- _SpnDictionary.cs
- ConfigurationErrorsException.cs
- ChangePassword.cs
- HWStack.cs
- StaticTextPointer.cs
- IPipelineRuntime.cs
- COAUTHINFO.cs
- ServiceHttpModule.cs
- codemethodreferenceexpression.cs
- SeparatorAutomationPeer.cs
- GetRecipientRequest.cs
- TypedTableGenerator.cs
- Substitution.cs
- PreviewPrintController.cs
- XamlStackWriter.cs
- ValidatorCompatibilityHelper.cs
- TabControl.cs
- CollectionView.cs
- securitymgrsite.cs