Build queries with QueryExpression:
1. A query expression is used for single-object searches. For example, you can create a search to return all accounts that match certain search criteria.
2. The QueryBase class is the base class for query expressions. There are three derived classes: QueryExpression, QueryByAttribute, and FetchExpression.
- The
QueryExpressionthe class supports complex queries. - The
QueryByAttributeclass is a simple means to search for entities where attributes match specified values. - The third derived class,
FetchExpressionis used with FetchXML, the proprietary Dataverse query language, can be used to perform some queries by using XML-based queries.
Query expressions are used in methods that retrieve more than one record, such as the IOrganizationService.RetrieveMultiple method.