EntityQueryExpression Class
Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online
Defines a complex query to retrieve entity metadata.
Namespace: Microsoft.Xrm.Sdk.Metadata.Query
Assembly: Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)
System.Object
Microsoft.Xrm.Sdk.Metadata.Query.MetadataQueryBase
Microsoft.Xrm.Sdk.Metadata.Query.MetadataQueryExpression
Microsoft.Xrm.Sdk.Metadata.Query.EntityQueryExpression
[DataContractAttribute(Name = "EntityQueryExpression", Namespace = "https://schemas.microsoft.com/xrm/2011/Metadata/Query")]
public sealed class EntityQueryExpression : MetadataQueryExpression
<DataContractAttribute(Name := "EntityQueryExpression", Namespace := "https://schemas.microsoft.com/xrm/2011/Metadata/Query")>
Public NotInheritable Class EntityQueryExpression
Inherits MetadataQueryExpression
Name | Description | |
---|---|---|
EntityQueryExpression() | Initializes a new instance of the EntityQueryExpression class. |
Name | Description | |
---|---|---|
AttributeQuery | Gets or sets a query expression for the entity attribute metadata to return. |
|
Criteria | Gets or sets the filter criteria for the metadata query.(Inherited from MetadataQueryExpression.) |
|
ExtensionData | Gets or sets the structure that contains extra data.(Inherited from MetadataQueryBase.) |
|
KeyQuery | ||
LabelQuery | Gets or sets a query expression for the labels to return. |
|
Properties | Gets or sets the properties to be returned by the query.(Inherited from MetadataQueryExpression.) |
|
RelationshipQuery | Gets or sets a query expression for the entity relationship metadata to return. |
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
ToString() | (Inherited from Object.) |
The following example shows the use of an EntityQueryExpression to retrieve entity metadata.
//An entity query expression to combine the filter expressions and property expressions for the query.
EntityQueryExpression entityQueryExpression = new EntityQueryExpression()
{
Criteria = EntityFilter,
Properties = EntityProperties,
AttributeQuery = new AttributeQueryExpression()
{
Criteria = AttributeFilter,
Properties = AttributeProperties
},
LabelQuery = labelQuery
};
//Retrieve the metadata for the query without a ClientVersionStamp
RetrieveMetadataChangesResponse initialRequest = getMetadataChanges(entityQueryExpression, null, DeletedMetadataFilters.OptionSet);
protected RetrieveMetadataChangesResponse getMetadataChanges(
EntityQueryExpression entityQueryExpression,
String clientVersionStamp,
DeletedMetadataFilters deletedMetadataFilter)
{
RetrieveMetadataChangesRequest retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest()
{
Query = entityQueryExpression,
ClientVersionStamp = clientVersionStamp,
DeletedMetadataFilters = deletedMetadataFilter
};
return (RetrieveMetadataChangesResponse)_service.Execute(retrieveMetadataChangesRequest);
}
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Microsoft.Xrm.Sdk.Metadata.Query Namespace
Retrieve and detect changes to metadata
Sample: Query metadata and detect changes
Return to top
Microsoft Dynamics 365
© 2016 Microsoft. All rights reserved. Copyright