QueryResult<T> Class

WCF RIA Services

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Message type used to communicate query results between the server and client.

System.Object
  System.ServiceModel.DomainServices.Client.QueryResult
    System.ServiceModel.DomainServices.Client.QueryResult<T>

Namespace:  System.ServiceModel.DomainServices.Client
Assembly:  System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)

[DataContractAttribute(Name = "QueryResultOf{0}", Namespace = "DomainServices")]
public sealed class QueryResult<T> : QueryResult

Type Parameters

T

The data type.

The QueryResult<T> type exposes the following members.

  NameDescription
Public methodQueryResult<T>()Initializes a new instance of the QueryResult<T> class with default values.
Public methodQueryResult<T>(IEnumerable<T>)Initializes a new instance of the QueryResult<T> class with the specified collection of result items.
Public methodQueryResult<T>(IEnumerable<T>, Int32)Initializes a new instance of the QueryResult<T> class with the specified collection of result items and total count.
Top

  NameDescription
Public propertyIncludedResultsGets or sets the included query results.
Public propertyRootResultsGets or sets the top-level query results.
Public propertyTotalCountGets or sets the total number of rows for the original query without any paging applied to it. (Inherited from QueryResult.)
Top

  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetIncludedResultsRetrieves the included results. (Overrides QueryResult.GetIncludedResults().)
Public methodGetRootResultsRetrieves the root results. (Overrides QueryResult.GetRootResults().)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Top

// Create an EntityQuery of type Customer
EntityQuery<Customer> query =
    from c in _customerContext.GetCustomersQuery()
    where c.Phone.StartsWith("583")
    orderby c.LastName
    select c;

// Create and execute a LoadOperation of type Customer and load 'query'
// LoadBehavior is set to merge this query into the current cache
LoadOperation<Customer> loadOp = this._customerContext.Load(query, LoadBehavior.MergeIntoCurrent, false);

// Create a new DomainOperationException for a Validation Error
DomainOperationException opEx = new DomainOperationException(
    "Validation Error",
    OperationErrorStatus.ValidationFailed,
    0x000024FA);

// Check if there are any ValidationErrors when loadOp was executed
// Then throw the DomainOperationException opEx
if (loadOp.ValidationErrors != null)
{
    throw opEx;
}

// Instantiate a new QueryResult of type Customer
QueryResult<Customer> qr = new QueryResult<Customer>();

// Populate the CustomerGrid with the QueryResults
CustomerGrid.ItemsSource = qr.IncludedResults;


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: