Beispiel #1
0
        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();
        }
Beispiel #3
0
        /// <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));
        }
Beispiel #4
0
        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)));
        }