Export (0) Print
Expand All

Retrieve data with queries

Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online

There are several ways to create queries in Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online. You can use .NET Language-Integrated Query (LINQ) in early and late binding scenarios, you can write queries by using FetchXML, the proprietary Microsoft Dynamics CRM query language, or you can build a query by using QueryExpression and the QueryExpression class.

The following table lists the basic capabilities of each query style.

 

Query style Capabilities

FetchXML

Supports all the features of QueryExpression plus aggregates and grouping. Queries are built as XML statements.

QueryExpression

Queries are built as an object model. Supports all the features in FetchXML except for aggregates and grouping.

LINQ

Queries are built using standard language, but internally uses QueryExpression so is limited to the features of QueryExpression.

Use FetchXML to create queries that return aggregates such as the sum of a value for all returned records. You can also perform “group by” operations with FetchXML.

.NET Language-Integrated Query (LINQ) uses standard query patterns. The OrganizationServiceContext class contains the LINQ query provider and is efficient at creating multiple associations.

The following messages are useful for working with queries when you want to convert between FetchXml and QueryExpression: FetchXmlToQueryExpressionRequest and QueryExpressionToFetchXmlRequest.

Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online
Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft