Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataWeb / Client / System / Data / Services / Client / QueryResponse.cs / 1 / QueryResponse.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Response to a batched query.
//
//---------------------------------------------------------------------
namespace System.Data.Services.Client
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
///
/// 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
{
/// Original query
private DataServiceRequest query;
/// Enumerable of objects in query
private System.Collections.IEnumerable results;
///
/// constructor
///
/// HTTP headers
/// original query
/// retrieved objects
internal QueryOperationResponse(Dictionary headers, DataServiceRequest query, System.Collections.IEnumerable results)
: base(headers)
{
this.query = query;
this.results = results;
}
/// The query that executed within the batch.
public DataServiceRequest Query
{
get { return this.query; }
}
/// get a non-null enumerable of the result
internal System.Collections.IEnumerable Results
{
get
{
if (null != this.Error)
{
throw System.Data.Services.Client.Error.InvalidOperation(Strings.Context_BatchExecuteError, this.Error);
}
return this.results ?? Array.CreateInstance(this.query.ElementType, 0);
}
}
/// Results from a query
/// enumerator of objects in query
public System.Collections.IEnumerator GetEnumerator()
{
return this.Results.GetEnumerator();
}
///
/// 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.
internal static QueryOperationResponse GetInstance(Type elementType, Dictionary headers, DataServiceRequest query, IEnumerable results)
{
Type genericType = typeof(QueryOperationResponse<>).MakeGenericType(elementType);
return (QueryOperationResponse)Activator.CreateInstance(
genericType,
BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { headers, query, results },
System.Globalization.CultureInfo.InvariantCulture);
}
}
}
// 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
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
///
/// 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
{
/// Original query
private DataServiceRequest query;
/// Enumerable of objects in query
private System.Collections.IEnumerable results;
///
/// constructor
///
/// HTTP headers
/// original query
/// retrieved objects
internal QueryOperationResponse(Dictionary headers, DataServiceRequest query, System.Collections.IEnumerable results)
: base(headers)
{
this.query = query;
this.results = results;
}
/// The query that executed within the batch.
public DataServiceRequest Query
{
get { return this.query; }
}
/// get a non-null enumerable of the result
internal System.Collections.IEnumerable Results
{
get
{
if (null != this.Error)
{
throw System.Data.Services.Client.Error.InvalidOperation(Strings.Context_BatchExecuteError, this.Error);
}
return this.results ?? Array.CreateInstance(this.query.ElementType, 0);
}
}
/// Results from a query
/// enumerator of objects in query
public System.Collections.IEnumerator GetEnumerator()
{
return this.Results.GetEnumerator();
}
///
/// 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.
internal static QueryOperationResponse GetInstance(Type elementType, Dictionary headers, DataServiceRequest query, IEnumerable results)
{
Type genericType = typeof(QueryOperationResponse<>).MakeGenericType(elementType);
return (QueryOperationResponse)Activator.CreateInstance(
genericType,
BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Instance,
null,
new object[] { headers, query, results },
System.Globalization.CultureInfo.InvariantCulture);
}
}
}
// 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
- RegexWorker.cs
- HttpVersion.cs
- SqlDataSourceView.cs
- RangeContentEnumerator.cs
- MetafileHeaderWmf.cs
- sqlinternaltransaction.cs
- RegexWriter.cs
- BitmapImage.cs
- RSAProtectedConfigurationProvider.cs
- BamlLocalizationDictionary.cs
- TextServicesCompartment.cs
- TCPListener.cs
- SubtreeProcessor.cs
- InkCanvasAutomationPeer.cs
- Propagator.JoinPropagator.cs
- ByteStreamMessageEncodingElement.cs
- CompilationUtil.cs
- ForceCopyBuildProvider.cs
- SqlNamer.cs
- AuthStoreRoleProvider.cs
- DefaultDiscoveryServiceExtension.cs
- GridViewRowPresenter.cs
- FileUtil.cs
- VerificationAttribute.cs
- DetailsViewDeleteEventArgs.cs
- Geometry.cs
- FontEditor.cs
- MonthChangedEventArgs.cs
- CheckPair.cs
- RequestNavigateEventArgs.cs
- PropertyState.cs
- TypeSystemHelpers.cs
- BackStopAuthenticationModule.cs
- IteratorDescriptor.cs
- DescendentsWalker.cs
- BitmapEffectInput.cs
- FacetValueContainer.cs
- XmlNamedNodeMap.cs
- Convert.cs
- AllMembershipCondition.cs
- SafePointer.cs
- DoubleLinkListEnumerator.cs
- PaintEvent.cs
- ContainerUtilities.cs
- WebSysDisplayNameAttribute.cs
- SelectionListComponentEditor.cs
- OracleDateTime.cs
- BuildProvider.cs
- NamespaceMapping.cs
- InlineObject.cs
- SqlDataSource.cs
- GB18030Encoding.cs
- TemplateControl.cs
- SimpleTypeResolver.cs
- EntityCommandCompilationException.cs
- ToolStripContainer.cs
- CombinedGeometry.cs
- DurableInstanceProvider.cs
- PointUtil.cs
- OleServicesContext.cs
- ConversionContext.cs
- CfgParser.cs
- GridItemCollection.cs
- PreviewPageInfo.cs
- AsyncPostBackTrigger.cs
- DataGridViewTextBoxEditingControl.cs
- QualifiedCellIdBoolean.cs
- DataGridViewSelectedRowCollection.cs
- SiteMapNodeItem.cs
- LazyTextWriterCreator.cs
- DiscoveryClientProtocol.cs
- BindingValueChangedEventArgs.cs
- ExplicitDiscriminatorMap.cs
- DateTimePicker.cs
- XmlSchemaSimpleTypeUnion.cs
- ImageListUtils.cs
- IPPacketInformation.cs
- EntityEntry.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- SafeArrayTypeMismatchException.cs
- SafeFileMappingHandle.cs
- Command.cs
- PrintPreviewGraphics.cs
- DataReaderContainer.cs
- SoapAttributeOverrides.cs
- InkCanvasSelectionAdorner.cs
- DbBuffer.cs
- EmptyQuery.cs
- QueryInterceptorAttribute.cs
- ClientFormsIdentity.cs
- ChangeTracker.cs
- RoleServiceManager.cs
- XmlNamespaceMapping.cs
- ComponentDispatcherThread.cs
- XmlAttributeAttribute.cs
- FixedTextBuilder.cs
- RawMouseInputReport.cs
- VisualTreeUtils.cs
- GeneratedContractType.cs
- LOSFormatter.cs