public AttributeInfo AddPseudoAttribute(string name, AttributeTypeCode attTypeCode, AttributeTypeDisplayName attDisplayName = null)
 {
     var factory = new AttributeInfoFactory();
     var attInfo = factory.CreatePseudo(this.EntityName, name, attTypeCode, attDisplayName);
     this.Attributes.Add(attInfo);
     return attInfo;
 }
Beispiel #2
0
        public AttributeInfo AddPseudoAttribute(string name, AttributeTypeCode attTypeCode, AttributeTypeDisplayName attDisplayName = null)
        {
            var factory = new AttributeInfoFactory();
            var attInfo = factory.CreatePseudo(this.EntityName, name, attTypeCode, attDisplayName);

            this.Attributes.Add(attInfo);
            return(attInfo);
        }
 public List<AttributeInfo> ConvertAttributeInfoList(IEnumerable<AttributeMetadata> attributeMetadata)
 {
     var results = new List<AttributeInfo>();
     var factory = new AttributeInfoFactory();
     foreach (var item in attributeMetadata)
     {
         AttributeInfo attInfo = factory.Create(item);
         results.Add(attInfo);
     }
     return results;
 }
Beispiel #4
0
        public List <AttributeInfo> ConvertAttributeInfoList(IEnumerable <AttributeMetadata> attributeMetadata)
        {
            var results = new List <AttributeInfo>();
            var factory = new AttributeInfoFactory();

            foreach (var item in attributeMetadata)
            {
                AttributeInfo attInfo = factory.Create(item);
                results.Add(attInfo);
            }
            return(results);
        }
        protected override ICrmOperationResult ExecuteCommand()
        {
            var command = DbCommand;
            var orgService = command.CrmDbConnection.OrganizationService;

            CrmAdo.EntityMetadataResultSet.DenormalisedMetadataResult[] results = null;
            var metadataResultSet = new EntityMetadataResultSet(command.CrmDbConnection, Request, Columns);
            CrmOperationResult commandResponse = null;

            if (IsSchemaOnly())
            {
                commandResponse = new CrmOperationResult(null, metadataResultSet, false);
            }
            else
            {
                var response = ExecuteOrganisationRequest();
                commandResponse = new CrmOperationResult(response, metadataResultSet, false);

                var retrieveMultipleResponse = response as RetrieveMetadataChangesResponse;
                if (retrieveMultipleResponse != null)
                {
                    // denormalise object graph to results.
                    if (retrieveMultipleResponse.EntityMetadata != null)
                    {
                        var attFactory = new AttributeInfoFactory();
                        results = (from r in retrieveMultipleResponse.EntityMetadata
                                   from a in (r.Attributes ?? Enumerable.Empty<AttributeMetadata>()).DefaultIfEmpty()
                                   from o in (r.OneToManyRelationships ?? Enumerable.Empty<OneToManyRelationshipMetadata>()).Union(r.ManyToOneRelationships ?? Enumerable.Empty<OneToManyRelationshipMetadata>()).DefaultIfEmpty()
                                   from m in (r.ManyToManyRelationships ?? Enumerable.Empty<ManyToManyRelationshipMetadata>()).DefaultIfEmpty()
                                   select new CrmAdo.EntityMetadataResultSet.DenormalisedMetadataResult { EntityMetadata = r, AttributeMetadata = attFactory.Create(a), OneToManyRelationship = o, ManyToManyRelationship = m }).ToArray();

                        // perform client side joins.
                        if (_clientSideJoinType.HasFlag(ClientSideMetadataJoinTypes.OneToManyRelationshipInnerJoin))
                        {
                            results = (from r in results where r.OneToManyRelationship != null select r).ToArray();
                        }
                        metadataResultSet.Results = results;
                    }
                }
            }

            return commandResponse;
        }