Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Common / CommandTrees / DbQueryCommandTree.cs / 1 / DbQueryCommandTree.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees.Internal;
namespace System.Data.Common.CommandTrees
{
///
/// Represents a query operation expressed as a canonical command tree.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbQueryCommandTree : DbCommandTree
{
private ExpressionLink _query;
///
/// Gets or sets an that defines the logic of the query operation.
///
/// The expression is null
/// The expression is associated with a different command tree
public DbExpression Query
{
get
{
return _query.Expression;
}
/*CQT_PUBLIC_API(*/internal/*)*/ set
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
EntityBid.Trace(" %d#, value=%d#, %d{cqt.DbExpressionKind}\n", this.ObjectId, DbExpression.GetObjectId(value), DbExpression.GetExpressionKind(value));
_query.Expression = value;
}
}
}
///
/// Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
///
/// The metadata workspace that the command tree should use.
/// The logical 'space' that metadata in the expressions used in this command tree must belong to.
/// or is null
/// does not represent a valid data space
/*CQT_PUBLIC_API(*/internal/*)*/ DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace) : base(metadata, dataSpace)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
_query = new ExpressionLink("Query", this);
}
}
///
/// Clones this command tree. This operation creates a new DbQueryCommandTree for which each expression property value is a clone of the corresponding property of this command tree.
///
/// The cloned command tree
/*CQT_PUBLIC_API(*/internal/*)*/ DbQueryCommandTree Clone()
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
DbQueryCommandTree newTree = new DbQueryCommandTree(
this.MetadataWorkspace,
this.DataSpace
);
this.CopyParametersTo(newTree);
if (this.Query != null)
{
newTree.Query = ExpressionCopier.Copy(newTree, this.Query);
}
return newTree;
}
}
internal override DbCommandTreeKind CommandTreeKind
{
get { return DbCommandTreeKind.Query; }
}
internal override void DumpStructure(ExpressionDumper dumper)
{
if (this.Query != null)
{
dumper.Dump(this.Query, "Query");
}
}
internal override string PrintTree(ExpressionPrinter printer)
{
return printer.Print(this);
}
internal override void Replace(ExpressionReplacer replacer)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
if (this.Query != null)
{
DbExpression newQuery = replacer.Replace(this.Query);
if (!object.ReferenceEquals(newQuery, this.Query))
{
this.Query = newQuery;
}
}
}
}
internal override void Validate(System.Data.Common.CommandTrees.Internal.Validator v)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
v.Validate(this);
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....], [....]
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees.Internal;
namespace System.Data.Common.CommandTrees
{
///
/// Represents a query operation expressed as a canonical command tree.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbQueryCommandTree : DbCommandTree
{
private ExpressionLink _query;
///
/// Gets or sets an that defines the logic of the query operation.
///
/// The expression is null
/// The expression is associated with a different command tree
public DbExpression Query
{
get
{
return _query.Expression;
}
/*CQT_PUBLIC_API(*/internal/*)*/ set
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
EntityBid.Trace(" %d#, value=%d#, %d{cqt.DbExpressionKind}\n", this.ObjectId, DbExpression.GetObjectId(value), DbExpression.GetExpressionKind(value));
_query.Expression = value;
}
}
}
///
/// Constructs a new DbQueryCommandTree that uses the specified metadata workspace.
///
/// The metadata workspace that the command tree should use.
/// The logical 'space' that metadata in the expressions used in this command tree must belong to.
/// or is null
/// does not represent a valid data space
/*CQT_PUBLIC_API(*/internal/*)*/ DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace) : base(metadata, dataSpace)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
_query = new ExpressionLink("Query", this);
}
}
///
/// Clones this command tree. This operation creates a new DbQueryCommandTree for which each expression property value is a clone of the corresponding property of this command tree.
///
/// The cloned command tree
/*CQT_PUBLIC_API(*/internal/*)*/ DbQueryCommandTree Clone()
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
DbQueryCommandTree newTree = new DbQueryCommandTree(
this.MetadataWorkspace,
this.DataSpace
);
this.CopyParametersTo(newTree);
if (this.Query != null)
{
newTree.Query = ExpressionCopier.Copy(newTree, this.Query);
}
return newTree;
}
}
internal override DbCommandTreeKind CommandTreeKind
{
get { return DbCommandTreeKind.Query; }
}
internal override void DumpStructure(ExpressionDumper dumper)
{
if (this.Query != null)
{
dumper.Dump(this.Query, "Query");
}
}
internal override string PrintTree(ExpressionPrinter printer)
{
return printer.Print(this);
}
internal override void Replace(ExpressionReplacer replacer)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
if (this.Query != null)
{
DbExpression newQuery = replacer.Replace(this.Query);
if (!object.ReferenceEquals(newQuery, this.Query))
{
this.Query = newQuery;
}
}
}
}
internal override void Validate(System.Data.Common.CommandTrees.Internal.Validator v)
{
using (new EntityBid.ScopeAuto(" %d#", this.ObjectId))
{
v.Validate(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
- ContentDesigner.cs
- DataSetSchema.cs
- DocumentSchemaValidator.cs
- SQLRoleProvider.cs
- ValidationErrorCollection.cs
- DataFieldConverter.cs
- HtmlTableRowCollection.cs
- MSAAWinEventWrap.cs
- EdgeModeValidation.cs
- TableSectionStyle.cs
- CollectionContainer.cs
- ItemChangedEventArgs.cs
- CodeVariableDeclarationStatement.cs
- MsmqException.cs
- FigureParaClient.cs
- Int64KeyFrameCollection.cs
- ValueTypeFixupInfo.cs
- xdrvalidator.cs
- GreenMethods.cs
- HuffCodec.cs
- ToolStripTextBox.cs
- HttpValueCollection.cs
- TypeFieldSchema.cs
- webeventbuffer.cs
- CatalogPartChrome.cs
- Geometry.cs
- CompModSwitches.cs
- PerformanceCounterNameAttribute.cs
- StreamSecurityUpgradeAcceptor.cs
- WebPartConnectionsEventArgs.cs
- HttpCacheVaryByContentEncodings.cs
- TouchesOverProperty.cs
- DataGridViewAutoSizeModeEventArgs.cs
- CreateUserWizard.cs
- CompModSwitches.cs
- IndicShape.cs
- CrossContextChannel.cs
- SecurityToken.cs
- UpdateProgress.cs
- GuidConverter.cs
- StickyNote.cs
- SafeMILHandle.cs
- HtmlWindow.cs
- BamlBinaryReader.cs
- SignerInfo.cs
- QuaternionKeyFrameCollection.cs
- DefaultPrintController.cs
- PrincipalPermission.cs
- MatrixTransform3D.cs
- ProviderConnectionPoint.cs
- RadioButton.cs
- RoleGroupCollection.cs
- PlatformCulture.cs
- KnownBoxes.cs
- DataGridViewCellStyle.cs
- RadioButton.cs
- Debug.cs
- _ServiceNameStore.cs
- UrlPropertyAttribute.cs
- SelectionEditor.cs
- HtmlInputPassword.cs
- EventInfo.cs
- CalendarButtonAutomationPeer.cs
- FileEnumerator.cs
- DbParameterCollectionHelper.cs
- WebPartChrome.cs
- DictionaryManager.cs
- IncomingWebResponseContext.cs
- WebControl.cs
- HiddenFieldPageStatePersister.cs
- PersonalizablePropertyEntry.cs
- hebrewshape.cs
- UserControlDocumentDesigner.cs
- CodeMemberField.cs
- PropertyPushdownHelper.cs
- BufferedReadStream.cs
- CacheHelper.cs
- InstanceKeyNotReadyException.cs
- PopupRootAutomationPeer.cs
- NumericUpDown.cs
- ListItemsCollectionEditor.cs
- ItemList.cs
- MeasureItemEvent.cs
- Hyperlink.cs
- FormatControl.cs
- ImageFormatConverter.cs
- StoreItemCollection.Loader.cs
- XmlSerializableReader.cs
- ExpressionBuilderCollection.cs
- ActiveXSite.cs
- UnsafeNativeMethodsPenimc.cs
- ReadOnlyAttribute.cs
- Rule.cs
- WindowsMenu.cs
- GridViewUpdatedEventArgs.cs
- AsyncPostBackTrigger.cs
- BaseTemplateBuildProvider.cs
- X509Utils.cs
- SelectionProcessor.cs
- TableColumnCollection.cs