QueryResult 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 the client.


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

[DataContractAttribute(Namespace = "DomainServices")]
public abstract class QueryResult

The QueryResult type exposes the following members.

Protected methodQueryResultInitializes a new instance of the QueryResult class.

Public propertyTotalCountGets or sets the total number of rows for the original query without any paging applied to it.

Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetIncludedResultsGets the included results.
Public methodGetRootResultsGets the root results.
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)

// 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",

// 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.