Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / QueryResponse.cs / 1625574 / QueryResponse.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Response to a batched query.
//
//---------------------------------------------------------------------
namespace System.Data.Services.Client
{
#region Namespaces.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Diagnostics;
#endregion Namespaces.
///
/// Response to a batched query.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010", Justification = "required for this feature")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710", Justification = "required for this feature")]
public class QueryOperationResponse : OperationResponse, System.Collections.IEnumerable
{
#region Private fields.
/// Original query
private readonly DataServiceRequest query;
/// Enumerable of objects in query
private readonly MaterializeAtom results;
#endregion Private fields.
///
/// constructor
///
/// HTTP headers
/// original query
/// retrieved objects
internal QueryOperationResponse(Dictionary headers, DataServiceRequest query, MaterializeAtom results)
: base(headers)
{
this.query = query;
this.results = results;
}
/// The query that executed within the batch.
public DataServiceRequest Query
{
get { return this.query; }
}
///
/// The server Result Set Count value from a query, if the query has requested the value
///
///
/// The return value can be either a zero or positive value equals to number of entities in the set on the server
///
///
/// Is thrown when count was not part of the original request, i.e., if the count tag is not found in the response stream.
///
public virtual long TotalCount
{
get
{
throw new NotSupportedException();
}
}
/// get a non-null enumerable of the result
internal MaterializeAtom Results
{
get
{
if (null != this.Error)
{
throw System.Data.Services.Client.Error.InvalidOperation(Strings.Context_BatchExecuteError, this.Error);
}
return this.results;
}
}
/// Results from a query
/// enumerator of objects in query
public System.Collections.IEnumerator GetEnumerator()
{
return this.Results.GetEnumerator();
}
///
/// Gets the continuation for the top level data stream associated with this response object
///
/// A continuation that points to the next page for the current data stream in the response.
public DataServiceQueryContinuation GetContinuation()
{
return this.results.GetContinuation(null);
}
///
/// Gets the continuation for the next page in the collection.
///
/// The collection, or null, if the top level link is to be retrieved
/// A continuation that points to the next page for the collection
public DataServiceQueryContinuation GetContinuation(IEnumerable collection)
{
return this.results.GetContinuation(collection);
}
///
/// Gets the continuation for the next page in the collection.
///
/// Element type for continuation results.
/// The collection, or null, if the top level link is to be retrieved
/// A continuation that points to the next page for the collection
public DataServiceQueryContinuation GetContinuation(IEnumerable collection)
{
return (DataServiceQueryContinuation)this.results.GetContinuation(collection);
}
///
/// Creates a generic instance of the QueryOperationResponse and return it
///
/// generic type for the QueryOperationResponse.
/// constructor parameter1
/// constructor parameter2
/// constructor parameter3
/// returns a new strongly typed instance of QueryOperationResponse.
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining | System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]
internal static QueryOperationResponse GetInstance(Type elementType, Dictionary headers, DataServiceRequest query, MaterializeAtom results)
{
Type genericType = typeof(QueryOperationResponse<>).MakeGenericType(elementType);
#if !ASTORIA_LIGHT
return (QueryOperationResponse)Activator.CreateInstance(
genericType,
BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { headers, query, results },
System.Globalization.CultureInfo.InvariantCulture);
#else
System.Reflection.ConstructorInfo[] info = genericType.GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance);
System.Diagnostics.Debug.Assert(1 == info.Length, "only expected 1 ctor");
return (QueryOperationResponse)Util.ConstructorInvoke(info[0],new object[] { headers, query, results });
#endif
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Response to a batched query.
//
//---------------------------------------------------------------------
namespace System.Data.Services.Client
{
#region Namespaces.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Diagnostics;
#endregion Namespaces.
///
/// Response to a batched query.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010", Justification = "required for this feature")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710", Justification = "required for this feature")]
public class QueryOperationResponse : OperationResponse, System.Collections.IEnumerable
{
#region Private fields.
/// Original query
private readonly DataServiceRequest query;
/// Enumerable of objects in query
private readonly MaterializeAtom results;
#endregion Private fields.
///
/// constructor
///
/// HTTP headers
/// original query
/// retrieved objects
internal QueryOperationResponse(Dictionary headers, DataServiceRequest query, MaterializeAtom results)
: base(headers)
{
this.query = query;
this.results = results;
}
/// The query that executed within the batch.
public DataServiceRequest Query
{
get { return this.query; }
}
///
/// The server Result Set Count value from a query, if the query has requested the value
///
///
/// The return value can be either a zero or positive value equals to number of entities in the set on the server
///
///
/// Is thrown when count was not part of the original request, i.e., if the count tag is not found in the response stream.
///
public virtual long TotalCount
{
get
{
throw new NotSupportedException();
}
}
/// get a non-null enumerable of the result
internal MaterializeAtom Results
{
get
{
if (null != this.Error)
{
throw System.Data.Services.Client.Error.InvalidOperation(Strings.Context_BatchExecuteError, this.Error);
}
return this.results;
}
}
/// Results from a query
/// enumerator of objects in query
public System.Collections.IEnumerator GetEnumerator()
{
return this.Results.GetEnumerator();
}
///
/// Gets the continuation for the top level data stream associated with this response object
///
/// A continuation that points to the next page for the current data stream in the response.
public DataServiceQueryContinuation GetContinuation()
{
return this.results.GetContinuation(null);
}
///
/// Gets the continuation for the next page in the collection.
///
/// The collection, or null, if the top level link is to be retrieved
/// A continuation that points to the next page for the collection
public DataServiceQueryContinuation GetContinuation(IEnumerable collection)
{
return this.results.GetContinuation(collection);
}
///
/// Gets the continuation for the next page in the collection.
///
/// Element type for continuation results.
/// The collection, or null, if the top level link is to be retrieved
/// A continuation that points to the next page for the collection
public DataServiceQueryContinuation GetContinuation(IEnumerable collection)
{
return (DataServiceQueryContinuation)this.results.GetContinuation(collection);
}
///
/// Creates a generic instance of the QueryOperationResponse and return it
///
/// generic type for the QueryOperationResponse.
/// constructor parameter1
/// constructor parameter2
/// constructor parameter3
/// returns a new strongly typed instance of QueryOperationResponse.
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining | System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]
internal static QueryOperationResponse GetInstance(Type elementType, Dictionary headers, DataServiceRequest query, MaterializeAtom results)
{
Type genericType = typeof(QueryOperationResponse<>).MakeGenericType(elementType);
#if !ASTORIA_LIGHT
return (QueryOperationResponse)Activator.CreateInstance(
genericType,
BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { headers, query, results },
System.Globalization.CultureInfo.InvariantCulture);
#else
System.Reflection.ConstructorInfo[] info = genericType.GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance);
System.Diagnostics.Debug.Assert(1 == info.Length, "only expected 1 ctor");
return (QueryOperationResponse)Util.ConstructorInvoke(info[0],new object[] { headers, query, results });
#endif
}
}
}
// 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
- ObjectNotFoundException.cs
- X509UI.cs
- XmlSerializerVersionAttribute.cs
- SynchronizedPool.cs
- PerformanceCounterCategory.cs
- ResourceProviderFactory.cs
- RadioButtonBaseAdapter.cs
- EntityDataSourceViewSchema.cs
- DispatcherFrame.cs
- IISMapPath.cs
- ParameterModifier.cs
- MsdtcClusterUtils.cs
- DbConnectionClosed.cs
- ExceptionUtil.cs
- DispatcherHooks.cs
- Scripts.cs
- AnonymousIdentificationModule.cs
- NativeMethods.cs
- isolationinterop.cs
- JapaneseCalendar.cs
- Point4DValueSerializer.cs
- TaiwanLunisolarCalendar.cs
- EmbeddedMailObjectsCollection.cs
- ListControlDesigner.cs
- UriTemplateLiteralQueryValue.cs
- SecurityContextKeyIdentifierClause.cs
- DataFormats.cs
- TreeIterators.cs
- AffineTransform3D.cs
- ApplicationServicesHostFactory.cs
- XmlQueryTypeFactory.cs
- LogAppendAsyncResult.cs
- SerializationUtility.cs
- XmlDataSourceDesigner.cs
- SimplePropertyEntry.cs
- typedescriptorpermission.cs
- ReadOnlyMetadataCollection.cs
- SafeLibraryHandle.cs
- SecurityException.cs
- PropertyDescriptorCollection.cs
- FactoryGenerator.cs
- SqlReorderer.cs
- EntityTypeEmitter.cs
- ConfigXmlElement.cs
- GridErrorDlg.cs
- ObjectDataSourceFilteringEventArgs.cs
- ControlAdapter.cs
- LinqToSqlWrapper.cs
- ParamArrayAttribute.cs
- Application.cs
- odbcmetadatacolumnnames.cs
- DbDataRecord.cs
- ExceptionAggregator.cs
- WebPartTracker.cs
- SessionPageStatePersister.cs
- ContentType.cs
- XmlSchemaParticle.cs
- QuaternionAnimationBase.cs
- TypeToArgumentTypeConverter.cs
- ClientSponsor.cs
- NamespaceInfo.cs
- TextModifierScope.cs
- WebBrowserUriTypeConverter.cs
- ClientSettingsProvider.cs
- RemoveStoryboard.cs
- DefaultShape.cs
- PassportPrincipal.cs
- CollectionViewGroupInternal.cs
- Request.cs
- Int16AnimationBase.cs
- JsonSerializer.cs
- RuleAction.cs
- TextBox.cs
- IteratorFilter.cs
- WindowsGrip.cs
- FlowPosition.cs
- TiffBitmapDecoder.cs
- SessionStateContainer.cs
- InputMethodStateChangeEventArgs.cs
- GetWinFXPath.cs
- ConfigurationProperty.cs
- DropShadowBitmapEffect.cs
- GridViewColumnCollectionChangedEventArgs.cs
- ContentIterators.cs
- ValidationRule.cs
- LineServicesCallbacks.cs
- OracleCommandBuilder.cs
- HttpListenerResponse.cs
- WebResponse.cs
- Symbol.cs
- CrossAppDomainChannel.cs
- Duration.cs
- Compiler.cs
- HttpPostedFile.cs
- ProviderMetadataCachedInformation.cs
- NodeCounter.cs
- TrackBar.cs
- AbstractDataSvcMapFileLoader.cs
- HintTextMaxWidthConverter.cs
- OutputWindow.cs