Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / CommandTrees / BasicCommandTreeVisitor.cs / 1305376 / BasicCommandTreeVisitor.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Diagnostics; using System.Data.Metadata.Edm; namespace System.Data.Common.CommandTrees { ////// An abstract base type for types that implement the IExpressionVisitor interface to derive from. /// /*CQT_PUBLIC_API(*/internal/*)*/ abstract class BasicCommandTreeVisitor : BasicExpressionVisitor { #region protected API, may be overridden to add functionality at specific points in the traversal protected virtual void VisitSetClause(DbSetClause setClause) { EntityUtil.CheckArgumentNull(setClause, "setClause"); this.VisitExpression(setClause.Property); this.VisitExpression(setClause.Value); } protected virtual void VisitModificationClause(DbModificationClause modificationClause) { EntityUtil.CheckArgumentNull(modificationClause, "modificationClause"); // Set clause is the only current possibility this.VisitSetClause((DbSetClause)modificationClause); } protected virtual void VisitModificationClauses(IListmodificationClauses) { EntityUtil.CheckArgumentNull(modificationClauses, "modificationClauses"); for (int idx = 0; idx < modificationClauses.Count; idx++) { this.VisitModificationClause(modificationClauses[idx]); } } #endregion #region public convenience API public virtual void VisitCommandTree(DbCommandTree commandTree) { EntityUtil.CheckArgumentNull(commandTree, "commandTree"); switch (commandTree.CommandTreeKind) { case DbCommandTreeKind.Delete: this.VisitDeleteCommandTree((DbDeleteCommandTree)commandTree); break; case DbCommandTreeKind.Function: this.VisitFunctionCommandTree((DbFunctionCommandTree)commandTree); break; case DbCommandTreeKind.Insert: this.VisitInsertCommandTree((DbInsertCommandTree)commandTree); break; case DbCommandTreeKind.Query: this.VisitQueryCommandTree((DbQueryCommandTree)commandTree); break; case DbCommandTreeKind.Update: this.VisitUpdateCommandTree((DbUpdateCommandTree)commandTree); break; default: throw EntityUtil.NotSupported(); } } #endregion #region CommandTree-specific Visitor Methods protected virtual void VisitDeleteCommandTree(DbDeleteCommandTree deleteTree) { EntityUtil.CheckArgumentNull(deleteTree, "deleteTree"); this.VisitExpressionBindingPre(deleteTree.Target); this.VisitExpression(deleteTree.Predicate); this.VisitExpressionBindingPost(deleteTree.Target); } protected virtual void VisitFunctionCommandTree(DbFunctionCommandTree functionTree) { EntityUtil.CheckArgumentNull(functionTree, "functionTree"); } protected virtual void VisitInsertCommandTree(DbInsertCommandTree insertTree) { EntityUtil.CheckArgumentNull(insertTree, "insertTree"); this.VisitExpressionBindingPre(insertTree.Target); this.VisitModificationClauses(insertTree.SetClauses); if (insertTree.Returning != null) { this.VisitExpression(insertTree.Returning); } this.VisitExpressionBindingPost(insertTree.Target); } protected virtual void VisitQueryCommandTree(DbQueryCommandTree queryTree) { EntityUtil.CheckArgumentNull(queryTree, "queryTree"); this.VisitExpression(queryTree.Query); } protected virtual void VisitUpdateCommandTree(DbUpdateCommandTree updateTree) { EntityUtil.CheckArgumentNull(updateTree, "updateTree"); this.VisitExpressionBindingPre(updateTree.Target); this.VisitModificationClauses(updateTree.SetClauses); this.VisitExpression(updateTree.Predicate); if (updateTree.Returning != null) { this.VisitExpression(updateTree.Returning); } this.VisitExpressionBindingPost(updateTree.Target); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Diagnostics; using System.Data.Metadata.Edm; namespace System.Data.Common.CommandTrees { ////// An abstract base type for types that implement the IExpressionVisitor interface to derive from. /// /*CQT_PUBLIC_API(*/internal/*)*/ abstract class BasicCommandTreeVisitor : BasicExpressionVisitor { #region protected API, may be overridden to add functionality at specific points in the traversal protected virtual void VisitSetClause(DbSetClause setClause) { EntityUtil.CheckArgumentNull(setClause, "setClause"); this.VisitExpression(setClause.Property); this.VisitExpression(setClause.Value); } protected virtual void VisitModificationClause(DbModificationClause modificationClause) { EntityUtil.CheckArgumentNull(modificationClause, "modificationClause"); // Set clause is the only current possibility this.VisitSetClause((DbSetClause)modificationClause); } protected virtual void VisitModificationClauses(IListmodificationClauses) { EntityUtil.CheckArgumentNull(modificationClauses, "modificationClauses"); for (int idx = 0; idx < modificationClauses.Count; idx++) { this.VisitModificationClause(modificationClauses[idx]); } } #endregion #region public convenience API public virtual void VisitCommandTree(DbCommandTree commandTree) { EntityUtil.CheckArgumentNull(commandTree, "commandTree"); switch (commandTree.CommandTreeKind) { case DbCommandTreeKind.Delete: this.VisitDeleteCommandTree((DbDeleteCommandTree)commandTree); break; case DbCommandTreeKind.Function: this.VisitFunctionCommandTree((DbFunctionCommandTree)commandTree); break; case DbCommandTreeKind.Insert: this.VisitInsertCommandTree((DbInsertCommandTree)commandTree); break; case DbCommandTreeKind.Query: this.VisitQueryCommandTree((DbQueryCommandTree)commandTree); break; case DbCommandTreeKind.Update: this.VisitUpdateCommandTree((DbUpdateCommandTree)commandTree); break; default: throw EntityUtil.NotSupported(); } } #endregion #region CommandTree-specific Visitor Methods protected virtual void VisitDeleteCommandTree(DbDeleteCommandTree deleteTree) { EntityUtil.CheckArgumentNull(deleteTree, "deleteTree"); this.VisitExpressionBindingPre(deleteTree.Target); this.VisitExpression(deleteTree.Predicate); this.VisitExpressionBindingPost(deleteTree.Target); } protected virtual void VisitFunctionCommandTree(DbFunctionCommandTree functionTree) { EntityUtil.CheckArgumentNull(functionTree, "functionTree"); } protected virtual void VisitInsertCommandTree(DbInsertCommandTree insertTree) { EntityUtil.CheckArgumentNull(insertTree, "insertTree"); this.VisitExpressionBindingPre(insertTree.Target); this.VisitModificationClauses(insertTree.SetClauses); if (insertTree.Returning != null) { this.VisitExpression(insertTree.Returning); } this.VisitExpressionBindingPost(insertTree.Target); } protected virtual void VisitQueryCommandTree(DbQueryCommandTree queryTree) { EntityUtil.CheckArgumentNull(queryTree, "queryTree"); this.VisitExpression(queryTree.Query); } protected virtual void VisitUpdateCommandTree(DbUpdateCommandTree updateTree) { EntityUtil.CheckArgumentNull(updateTree, "updateTree"); this.VisitExpressionBindingPre(updateTree.Target); this.VisitModificationClauses(updateTree.SetClauses); this.VisitExpression(updateTree.Predicate); if (updateTree.Returning != null) { this.VisitExpression(updateTree.Returning); } this.VisitExpressionBindingPost(updateTree.Target); } #endregion } } // 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
- MissingSatelliteAssemblyException.cs
- UIHelper.cs
- ClrPerspective.cs
- BaseValidator.cs
- HostingEnvironmentWrapper.cs
- SourceExpressionException.cs
- TreeNodeCollection.cs
- UrlMappingCollection.cs
- UTF7Encoding.cs
- SecurityChannelFactory.cs
- HttpHeaderCollection.cs
- DataGridViewCellStyleChangedEventArgs.cs
- DockPanel.cs
- TextReader.cs
- LabelAutomationPeer.cs
- EndpointInstanceProvider.cs
- ConfigurationStrings.cs
- XmlSchemaAny.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- RijndaelManagedTransform.cs
- Accessible.cs
- FaultContractAttribute.cs
- RefreshInfo.cs
- ScrollItemProviderWrapper.cs
- ApplicationServiceManager.cs
- MemoryFailPoint.cs
- SettingsPropertyValue.cs
- ListBox.cs
- ExpressionEditorSheet.cs
- DriveNotFoundException.cs
- JpegBitmapEncoder.cs
- HtmlTernaryTree.cs
- SafeWaitHandle.cs
- ColumnTypeConverter.cs
- SelectionEditor.cs
- WrapperSecurityCommunicationObject.cs
- ReferencedType.cs
- StrokeNode.cs
- DataGridColumnEventArgs.cs
- TextModifierScope.cs
- LongTypeConverter.cs
- ColorTranslator.cs
- BorderSidesEditor.cs
- StubHelpers.cs
- FormViewRow.cs
- AttachedPropertiesService.cs
- brushes.cs
- FormsAuthenticationConfiguration.cs
- EntityProxyFactory.cs
- Int64AnimationUsingKeyFrames.cs
- HierarchicalDataSourceControl.cs
- ManifestResourceInfo.cs
- SQLMembershipProvider.cs
- WeakEventManager.cs
- NavigationWindowAutomationPeer.cs
- XmlQueryOutput.cs
- ConditionalExpression.cs
- ProgressiveCrcCalculatingStream.cs
- DocumentAutomationPeer.cs
- FontCacheUtil.cs
- TdsRecordBufferSetter.cs
- SignatureResourcePool.cs
- CompiledWorkflowDefinitionContext.cs
- NameValueSectionHandler.cs
- LinearKeyFrames.cs
- HttpsTransportElement.cs
- DataList.cs
- QilExpression.cs
- Transaction.cs
- XmlHierarchyData.cs
- EngineSite.cs
- Propagator.JoinPropagator.cs
- XmlSortKeyAccumulator.cs
- PKCS1MaskGenerationMethod.cs
- safemediahandle.cs
- AuthorizationSection.cs
- EndOfStreamException.cs
- DataTableMappingCollection.cs
- PackageRelationshipCollection.cs
- ChtmlTextBoxAdapter.cs
- XmlSchemaParticle.cs
- ADMembershipProvider.cs
- MatrixValueSerializer.cs
- CompilationUtil.cs
- WeakRefEnumerator.cs
- LinqDataView.cs
- ProfileEventArgs.cs
- FixedSOMPageElement.cs
- TextFormatterContext.cs
- XmlSchemaValidator.cs
- NameValueCollection.cs
- InfoCardSymmetricCrypto.cs
- TextElementCollectionHelper.cs
- SingleAnimationBase.cs
- XmlNode.cs
- ResourceSetExpression.cs
- ProfilePropertySettingsCollection.cs
- CssTextWriter.cs
- SqlCaseSimplifier.cs
- ScrollEvent.cs