public CrmEntityMetadataAdapter(EntityMetadata entityMetadata) { Func <AttributeMetadata, ICrmAttributeMetadata> selector = null; this.entityMetadata = entityMetadata; this.attributeMetadataFactory = new CrmAttributeMetadataFactory(); if (entityMetadata.Attributes != null) { this.attributes = entityMetadata.Attributes.Select(e => this.attributeMetadataFactory.Create(e)).ToArray(); } }
/// <summary> /// Initializes a new instance of the <see cref="CrmEntityMetadataAdapter"/> class. /// </summary> /// <param name="entityMetadata">The entity metadata.</param> public CrmEntityMetadataAdapter(EntityMetadata entityMetadata) { this.entityMetadata = entityMetadata; this.attributeMetadataFactory = new CrmAttributeMetadataFactory(); if (entityMetadata.Attributes == null) { return; } this.attributes = entityMetadata.Attributes.Select(a => this.attributeMetadataFactory.Create(a)).ToArray(); }
/// <summary> /// Gets the attribute metadata. /// </summary> /// <param name="entityName">Name of the entity.</param> /// <param name="attributeName">Name of the attribute.</param> /// <returns> /// Crm attribute metadata /// </returns> public override ICrmAttributeMetadata GetAttributeMetadata(string entityName, string attributeName) { var crmAttributeMetadataFactory = new CrmAttributeMetadataFactory(); var attributeResponse = (RetrieveAttributeResponse)this.organizationServiceCache.GetOrganizationService().Execute(new RetrieveAttributeRequest { EntityLogicalName = entityName, LogicalName = attributeName, RetrieveAsIfPublished = true }); return(crmAttributeMetadataFactory.Create(attributeResponse.AttributeMetadata)); }
public override ICrmAttributeMetadata GetAttributeMetadata(string entityName, string attributeName) { CrmAttributeMetadataFactory factory = new CrmAttributeMetadataFactory(); RetrieveAttributeRequest request = new RetrieveAttributeRequest { EntityLogicalName = entityName, LogicalName = attributeName, RetrieveAsIfPublished = true }; RetrieveAttributeResponse response = (RetrieveAttributeResponse)this._organizationService.Execute(request); return(factory.Create(response.AttributeMetadata)); }
/// <summary> /// Gets the attribute metadata. /// </summary> /// <param name="entityName">Name of the entity.</param> /// <param name="attributeName">Name of the attribute.</param> public override ICrmAttributeMetadata GetAttributeMetadata(string entityName, string attributeName) { var crmAttributeMetadataFactory = new CrmAttributeMetadataFactory(); return(crmAttributeMetadataFactory.Create(this.crmMetadataService.RetrieveAttributeMetadata(entityName, attributeName))); }