Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / CommandTrees / DbQueryCommandTree.cs / 1305376 / DbQueryCommandTree.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees.Internal; using System.Linq; using System.Diagnostics; 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 { // Query expression private readonly DbExpression _query; // Parameter information (will be retrieved from the components of the command tree before construction) private System.Collections.ObjectModel.ReadOnlyCollection_parameters; private DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query, bool validate) : base(metadata, dataSpace) { // Ensure the query expression is non-null EntityUtil.CheckArgumentNull(query, "query"); using (new EntityBid.ScopeAuto(" %d#, query=%d#", this.ObjectId, query.ObjectId)) { if (validate) { // Use the valid workspace and data space to validate the query expression DbExpressionValidator validator = new DbExpressionValidator(metadata, dataSpace); validator.ValidateExpression(query, "query"); this._parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly(); } this._query = query; } } /// /// 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. /// Athat defines the logic of the query. /// /// or is null /*CQT_PUBLIC_API(*/internal/*)*/ DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query) : this(metadata, dataSpace, query, true) { } /// does not represent a valid data space /// Gets a public DbExpression Query { get { return this._query; } } internal override DbCommandTreeKind CommandTreeKind { get { return DbCommandTreeKind.Query; } } internal override IEnumerablethat defines the logic of the query. /// > GetParameters() { if (this._parameters == null) { this._parameters = ParameterRetriever.GetParameters(this); } return this._parameters.Select(p => new KeyValuePair (p.ParameterName, p.ResultType)); } 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 static DbQueryCommandTree FromValidExpression(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query) { #if DEBUG return new DbQueryCommandTree(metadata, dataSpace, query); #else return new DbQueryCommandTree(metadata, dataSpace, query, false); #endif } } } // 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 [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees.Internal; using System.Linq; using System.Diagnostics; 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 { // Query expression private readonly DbExpression _query; // Parameter information (will be retrieved from the components of the command tree before construction) private System.Collections.ObjectModel.ReadOnlyCollection_parameters; private DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query, bool validate) : base(metadata, dataSpace) { // Ensure the query expression is non-null EntityUtil.CheckArgumentNull(query, "query"); using (new EntityBid.ScopeAuto(" %d#, query=%d#", this.ObjectId, query.ObjectId)) { if (validate) { // Use the valid workspace and data space to validate the query expression DbExpressionValidator validator = new DbExpressionValidator(metadata, dataSpace); validator.ValidateExpression(query, "query"); this._parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly(); } this._query = query; } } /// /// 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. /// Athat defines the logic of the query. /// /// or is null /*CQT_PUBLIC_API(*/internal/*)*/ DbQueryCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query) : this(metadata, dataSpace, query, true) { } /// does not represent a valid data space /// Gets a public DbExpression Query { get { return this._query; } } internal override DbCommandTreeKind CommandTreeKind { get { return DbCommandTreeKind.Query; } } internal override IEnumerablethat defines the logic of the query. /// > GetParameters() { if (this._parameters == null) { this._parameters = ParameterRetriever.GetParameters(this); } return this._parameters.Select(p => new KeyValuePair (p.ParameterName, p.ResultType)); } 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 static DbQueryCommandTree FromValidExpression(MetadataWorkspace metadata, DataSpace dataSpace, DbExpression query) { #if DEBUG return new DbQueryCommandTree(metadata, dataSpace, query); #else return new DbQueryCommandTree(metadata, dataSpace, query, false); #endif } } } // 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
- TransactionFilter.cs
- WpfSharedBamlSchemaContext.cs
- DaylightTime.cs
- BindingMemberInfo.cs
- TagPrefixInfo.cs
- DataTablePropertyDescriptor.cs
- XmlReturnReader.cs
- SQLGuidStorage.cs
- DataGridTextBox.cs
- PenLineJoinValidation.cs
- DataKey.cs
- PageHandlerFactory.cs
- NavigationFailedEventArgs.cs
- HttpHandlerActionCollection.cs
- FieldBuilder.cs
- QueryOutputWriter.cs
- FormViewDesigner.cs
- MailWriter.cs
- Ipv6Element.cs
- BidPrivateBase.cs
- BrushMappingModeValidation.cs
- IOException.cs
- ServiceInstanceProvider.cs
- InteropEnvironment.cs
- MemberInitExpression.cs
- CharStorage.cs
- RewritingValidator.cs
- KeyConstraint.cs
- WebPartEditorOkVerb.cs
- LogAppendAsyncResult.cs
- Encoder.cs
- DesignerWithHeader.cs
- EntitySqlQueryCacheKey.cs
- PropertyDescriptorGridEntry.cs
- PropertyInformation.cs
- Crypto.cs
- MessageSmuggler.cs
- UriScheme.cs
- ExecutionScope.cs
- DesignOnlyAttribute.cs
- CodeExpressionCollection.cs
- HttpCookiesSection.cs
- ArrayTypeMismatchException.cs
- CannotUnloadAppDomainException.cs
- SocketAddress.cs
- DispatcherEventArgs.cs
- Utilities.cs
- DomainUpDown.cs
- VideoDrawing.cs
- MemberInfoSerializationHolder.cs
- _LocalDataStoreMgr.cs
- InvalidOleVariantTypeException.cs
- RotationValidation.cs
- LambdaCompiler.Logical.cs
- PropertyEmitterBase.cs
- SourceItem.cs
- KnownBoxes.cs
- StandardTransformFactory.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- XmlDesignerDataSourceView.cs
- HtmlTableRow.cs
- MsmqIntegrationReceiveParameters.cs
- BinaryObjectInfo.cs
- ResourceReferenceExpression.cs
- CompilerParameters.cs
- SoapBinding.cs
- BStrWrapper.cs
- CodeSnippetExpression.cs
- PropertyItemInternal.cs
- VerticalAlignConverter.cs
- ReflectionHelper.cs
- BinaryFormatterSinks.cs
- TriState.cs
- ServiceAuthorizationElement.cs
- CatalogZone.cs
- LinqDataSource.cs
- ModuleBuilderData.cs
- DbConnectionInternal.cs
- XmlConvert.cs
- CheckBoxBaseAdapter.cs
- ToolStripMenuItem.cs
- RenderData.cs
- NonVisualControlAttribute.cs
- FontCacheUtil.cs
- ProfileServiceManager.cs
- TemplateBindingExpression.cs
- GeneralTransform3D.cs
- _LazyAsyncResult.cs
- AppDomainGrammarProxy.cs
- SmtpSection.cs
- CodeParameterDeclarationExpression.cs
- Stream.cs
- BamlBinaryReader.cs
- StreamGeometryContext.cs
- MetadataSource.cs
- WasEndpointConfigContainer.cs
- DataProtection.cs
- ShutDownListener.cs
- InputLanguage.cs
- FrameworkElementFactoryMarkupObject.cs