Compartir a través de


Clase de AttributeQueryExpression

Se aplica a: CRM 2015 on-prem, CRM Online

Defines a complex query to retrieve attribute metadata for entities retrieved using an EntityQueryExpression

Espacio de nombres: Microsoft.Xrm.Sdk.Metadata.Query
Ensamblado: Microsoft.Xrm.Sdk (en Microsoft.Xrm.Sdk.dll)

Sintaxis

'Declaración
<DataContractAttribute(Name:="AttributeQueryExpression", Namespace:="https://schemas.microsoft.com/xrm/2011/Metadata/Query")> _
Public NotInheritable Class AttributeQueryExpression
    Inherits MetadataQueryExpression
[DataContractAttribute(Name="AttributeQueryExpression", Namespace="https://schemas.microsoft.com/xrm/2011/Metadata/Query")] 
public sealed class AttributeQueryExpression : MetadataQueryExpression

Comentarios

The following example shows the use of an AttributeQueryExpression to retrieve entity metadata.

//A condition expresson to return optionset attributes
MetadataConditionExpression[] optionsetAttributeTypes = new MetadataConditionExpression[] { 
new MetadataConditionExpression("AttributeType", MetadataConditionOperator.Equals, AttributeTypeCode.Picklist),
new MetadataConditionExpression("AttributeType", MetadataConditionOperator.Equals, AttributeTypeCode.State),
new MetadataConditionExpression("AttributeType", MetadataConditionOperator.Equals, AttributeTypeCode.Status),
new MetadataConditionExpression("AttributeType", MetadataConditionOperator.Equals, AttributeTypeCode.Boolean)
};

//A filter expression to apply the optionsetAttributeTypes condition expression
MetadataFilterExpression AttributeFilter = new MetadataFilterExpression(LogicalOperator.Or);
AttributeFilter.Conditions.AddRange(optionsetAttributeTypes);

//A Properties expression to limit the properties to be included with attributes
MetadataPropertiesExpression AttributeProperties = new MetadataPropertiesExpression() { AllProperties = false };
AttributeProperties.PropertyNames.Add("OptionSet");
AttributeProperties.PropertyNames.Add("AttributeType");
   
   
   ...
   
   
   
//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);

Jerarquía heredada

System.Object
   Microsoft.Xrm.Sdk.Metadata.Query.MetadataQueryBase
     Microsoft.Xrm.Sdk.Metadata.Query.MetadataQueryExpression
      Microsoft.Xrm.Sdk.Metadata.Query.AttributeQueryExpression

Seguridad de hilo

Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para el hilo. No se garantiza que los miembros de instancia sean seguros para el hilo.

Plataformas

Plataformas de desarrollo

Windows Vista, Windows Server 2003 y

Plataformas de destino

Windows 98,Windows 2000,Windows 2000 Server,Windows CE,Windows Server 2008,Windows 98 Second Edition,Pocket PC,Teléfono inteligente,Windows Server 2003,Windows XP Professional,Windows Vista,Windows XP

Change History

Vea también

Referencia

Miembros de AttributeQueryExpression
Espacio de nombres de Microsoft.Xrm.Sdk.Metadata.Query

Otros recursos

Query and Capture Changes to Metadata
Sample: Query Metadata and Detect Changes

Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.