Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Objects / objectquery_tresulttype.cs / 1 / objectquery_tresulttype.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupowner [....] //--------------------------------------------------------------------- using System; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Diagnostics; using System.Data; using System.Data.Common; using System.Data.Common.EntitySql; using System.Data.Common.Utils; using System.Data.Mapping; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees; using System.Data.Common.CommandTrees.Internal; using System.Data.Objects.DataClasses; using System.Data.Objects.ELinq; using System.Data.Objects.Internal; using System.Data.Common.QueryCache; using System.Data.EntityClient; using System.Linq; using System.Linq.Expressions; namespace System.Data.Objects { ////// This class implements strongly-typed queries at the object-layer through /// Entity SQL text and query-building helper methods. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] public partial class ObjectQuery: ObjectQuery, IEnumerable , IQueryable , IOrderedQueryable , IListSource { internal ObjectQuery(ObjectQueryState queryState) : base(queryState) { } #region Public Methods /// /// This method allows explicit query evaluation with a specified merge /// option which will override the merge option property. /// /// /// The MergeOption to use when executing the query. /// ////// An enumerable for the ObjectQuery results. /// public new ObjectResultExecute(MergeOption mergeOption) { EntityUtil.CheckArgumentMergeOption(mergeOption); return this.GetResults(mergeOption); } /// /// Adds a path to the set of navigation property span paths included in the results of this query /// /// The new span path ///A new ObjectQuery that includes the specified span path public ObjectQueryInclude(string path) { EntityUtil.CheckStringArgument(path, "path"); return new ObjectQuery (this.QueryState.Include(this, path)); } #endregion #region IEnumerable implementation /// /// These methods are the "executors" for the query. They can be called /// directly, or indirectly (by foreach'ing through the query, for example). /// IEnumeratorIEnumerable .GetEnumerator() { ObjectResult disposableEnumerable = this.GetResults(null); try { IEnumerator result = disposableEnumerable.GetEnumerator(); return result; } catch { // if there is a problem creating the enumerator, we should dispose // the enumerable (if there is no problem, the enumerator will take // care of the dispose) disposableEnumerable.Dispose(); throw; } } #endregion #region ObjectQuery Overrides internal override IEnumerator GetEnumeratorInternal() { return ((IEnumerable )this).GetEnumerator(); } internal override IList GetIListSourceListInternal() { return ((IListSource)this.GetResults(null)).GetList(); } internal override ObjectResult ExecuteInternal(MergeOption mergeOption) { return this.GetResults(mergeOption); } #endregion #region Private Methods private ObjectResult GetResults(MergeOption? forMergeOption) { this.QueryState.ObjectContext.EnsureConnection(); try { ObjectQueryExecutionPlan execPlan = this.QueryState.GetExecutionPlan(forMergeOption); return execPlan.Execute (this.QueryState.ObjectContext, this.QueryState.Parameters); } catch { this.QueryState.ObjectContext.ReleaseConnection(); throw; } } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupowner [....] //--------------------------------------------------------------------- using System; using System.Text.RegularExpressions; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Diagnostics; using System.Data; using System.Data.Common; using System.Data.Common.EntitySql; using System.Data.Common.Utils; using System.Data.Mapping; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees; using System.Data.Common.CommandTrees.Internal; using System.Data.Objects.DataClasses; using System.Data.Objects.ELinq; using System.Data.Objects.Internal; using System.Data.Common.QueryCache; using System.Data.EntityClient; using System.Linq; using System.Linq.Expressions; namespace System.Data.Objects { ////// This class implements strongly-typed queries at the object-layer through /// Entity SQL text and query-building helper methods. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] public partial class ObjectQuery: ObjectQuery, IEnumerable , IQueryable , IOrderedQueryable , IListSource { internal ObjectQuery(ObjectQueryState queryState) : base(queryState) { } #region Public Methods /// /// This method allows explicit query evaluation with a specified merge /// option which will override the merge option property. /// /// /// The MergeOption to use when executing the query. /// ////// An enumerable for the ObjectQuery results. /// public new ObjectResultExecute(MergeOption mergeOption) { EntityUtil.CheckArgumentMergeOption(mergeOption); return this.GetResults(mergeOption); } /// /// Adds a path to the set of navigation property span paths included in the results of this query /// /// The new span path ///A new ObjectQuery that includes the specified span path public ObjectQueryInclude(string path) { EntityUtil.CheckStringArgument(path, "path"); return new ObjectQuery (this.QueryState.Include(this, path)); } #endregion #region IEnumerable implementation /// /// These methods are the "executors" for the query. They can be called /// directly, or indirectly (by foreach'ing through the query, for example). /// IEnumeratorIEnumerable .GetEnumerator() { ObjectResult disposableEnumerable = this.GetResults(null); try { IEnumerator result = disposableEnumerable.GetEnumerator(); return result; } catch { // if there is a problem creating the enumerator, we should dispose // the enumerable (if there is no problem, the enumerator will take // care of the dispose) disposableEnumerable.Dispose(); throw; } } #endregion #region ObjectQuery Overrides internal override IEnumerator GetEnumeratorInternal() { return ((IEnumerable )this).GetEnumerator(); } internal override IList GetIListSourceListInternal() { return ((IListSource)this.GetResults(null)).GetList(); } internal override ObjectResult ExecuteInternal(MergeOption mergeOption) { return this.GetResults(mergeOption); } #endregion #region Private Methods private ObjectResult GetResults(MergeOption? forMergeOption) { this.QueryState.ObjectContext.EnsureConnection(); try { ObjectQueryExecutionPlan execPlan = this.QueryState.GetExecutionPlan(forMergeOption); return execPlan.Execute (this.QueryState.ObjectContext, this.QueryState.Parameters); } catch { this.QueryState.ObjectContext.ReleaseConnection(); throw; } } #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
- ProfileBuildProvider.cs
- DataGridViewCellStyleBuilderDialog.cs
- UIElementPropertyUndoUnit.cs
- ClonableStack.cs
- PassportAuthenticationEventArgs.cs
- DBCSCodePageEncoding.cs
- TransportationConfigurationTypeInstallComponent.cs
- ExpressionPrefixAttribute.cs
- SchemaDeclBase.cs
- CurrencyManager.cs
- OLEDB_Enum.cs
- SplitContainer.cs
- FixedSOMLineRanges.cs
- RadialGradientBrush.cs
- DataTableCollection.cs
- ExpandSegmentCollection.cs
- WebConfigurationHostFileChange.cs
- ProcessThread.cs
- ConnectionPointConverter.cs
- CustomAttributeSerializer.cs
- UrlMappingsModule.cs
- CompilerLocalReference.cs
- NominalTypeEliminator.cs
- WorkflowTimerService.cs
- SynchronizedDispatch.cs
- FlowchartDesigner.Helpers.cs
- SqlServices.cs
- ToolStripItemDataObject.cs
- __ConsoleStream.cs
- FormatSettings.cs
- Activator.cs
- AdPostCacheSubstitution.cs
- RC2.cs
- PropertyNames.cs
- Char.cs
- ErrorHandlerModule.cs
- TargetControlTypeCache.cs
- EntityDataSourceReferenceGroup.cs
- PersistenceTypeAttribute.cs
- DataGridItemEventArgs.cs
- DaylightTime.cs
- CheckBoxFlatAdapter.cs
- DeclaredTypeValidator.cs
- TabPanel.cs
- AssemblyContextControlItem.cs
- WebPartConnectionCollection.cs
- BindingOperations.cs
- ComplexBindingPropertiesAttribute.cs
- dataprotectionpermission.cs
- SoapInteropTypes.cs
- Utilities.cs
- MediaPlayerState.cs
- SByteConverter.cs
- OLEDB_Enum.cs
- TransportationConfigurationTypeInstallComponent.cs
- GridViewDeletedEventArgs.cs
- ProfilePropertyMetadata.cs
- GrammarBuilderDictation.cs
- EventLogPermissionAttribute.cs
- UnsafeNativeMethods.cs
- DataTableMapping.cs
- ProfileBuildProvider.cs
- SafeWaitHandle.cs
- MouseOverProperty.cs
- SQLMoneyStorage.cs
- FileEnumerator.cs
- Viewport3DAutomationPeer.cs
- StatusBarItemAutomationPeer.cs
- ProfileManager.cs
- mediaclock.cs
- FixUp.cs
- XmlReaderSettings.cs
- XmlNodeChangedEventArgs.cs
- GestureRecognizer.cs
- Repeater.cs
- BitmapEffectOutputConnector.cs
- WebServicesDescriptionAttribute.cs
- Span.cs
- SkinBuilder.cs
- FileRecordSequenceHelper.cs
- SyncMethodInvoker.cs
- _ListenerAsyncResult.cs
- Vector3DIndependentAnimationStorage.cs
- Util.cs
- ComboBox.cs
- SignatureConfirmationElement.cs
- TrueReadOnlyCollection.cs
- TraversalRequest.cs
- ExtentKey.cs
- GPPOINT.cs
- FormatPage.cs
- UserControlCodeDomTreeGenerator.cs
- SystemIPInterfaceStatistics.cs
- FixedSOMLineCollection.cs
- TextProviderWrapper.cs
- NativeMethods.cs
- TextBoxLine.cs
- MSAAEventDispatcher.cs
- RegexGroup.cs
- GuidTagList.cs