EntityQueryExpression Class

EntityQueryExpression Class

 

Defines a complex query to retrieve entity metadata.

Namespace:   Microsoft.Xrm.Sdk.Metadata.Query
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)


[DataContractAttribute(Name = "EntityQueryExpression", Namespace = "http://schemas.microsoft.com/xrm/2011/Metadata/Query")]
public sealed class EntityQueryExpression : MetadataQueryExpression

NameDescription
System_CAPS_pubmethodEntityQueryExpression()

Initializes a new instance of the EntityQueryExpression class.

NameDescription
System_CAPS_pubpropertyAttributeQuery

Gets or sets a query expression for the entity attribute metadata to return.

System_CAPS_pubpropertyCriteria

Gets or sets the filter criteria for the metadata query.(Inherited from MetadataQueryExpression.)

System_CAPS_pubpropertyExtensionData

Gets or sets the structure that contains extra data.(Inherited from MetadataQueryBase.)

System_CAPS_pubpropertyKeyQuery

System_CAPS_pubpropertyLabelQuery

Gets or sets a query expression for the labels to return.

System_CAPS_pubpropertyProperties

Gets or sets the properties to be returned by the query.(Inherited from MetadataQueryExpression.)

System_CAPS_pubpropertyRelationshipQuery

Gets or sets a query expression for the entity relationship metadata to return.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

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

Return to top

Microsoft Dynamics CRM 2016 and CRM Online

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

ADD
Show:
© 2016 Microsoft