Export (0) Print
Expand All

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.

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(Namespace = "DomainServices")]
public abstract class QueryResult

The QueryResult type exposes the following members.

  NameDescription
Protected methodQueryResultInitializes a new instance of the QueryResult class.
Top

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

  NameDescription
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.)
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:
© 2014 Microsoft