Пример #1
0
        protected override ICrmOperationResult ExecuteCommand()
        {
            CrmOperationResult commandResponse = null;
            var resultSet = CreateEntityResultSet();
            var response = ExecuteOrganisationRequest();
            commandResponse = new CrmOperationResult(response, resultSet, false);

            var createResponse = response as CreateEntityResponse;
            if (createResponse != null)
            {
                // AssignResponseParameter(command, response);
                // for execute reader and execute scalar purposes, we provide a result that just ahs the newly created id of the entity.
                var result = new Entity("entitymetadata");
                var idattname = string.Format("entitymetadataid");

                result[idattname] = createResponse.EntityId;
                result.Id = createResponse.EntityId;
                result["primaryattributeid"] = createResponse.AttributeId;

                resultSet.Results = new EntityCollection(new List<Entity>(new Entity[] { result }));

            }

            return commandResponse;
        }
Пример #2
0
        protected override ICrmOperationResult ExecuteCommand()
        {
            CrmOperationResult commandResponse = null;
            var resultSet = CreateEntityResultSet();
            var response  = ExecuteOrganisationRequest();

            commandResponse = new CrmOperationResult(response, resultSet, false);

            var createResponse = response as CreateEntityResponse;

            if (createResponse != null)
            {
                // AssignResponseParameter(command, response);
                // for execute reader and execute scalar purposes, we provide a result that just ahs the newly created id of the entity.
                var result    = new Entity("entitymetadata");
                var idattname = string.Format("entitymetadataid");

                result[idattname]            = createResponse.EntityId;
                result.Id                    = createResponse.EntityId;
                result["primaryattributeid"] = createResponse.AttributeId;

                resultSet.Results = new EntityCollection(new List <Entity>(new Entity[] { result }));
            }

            return(commandResponse);
        }
Пример #3
0
 protected override ICrmOperationResult ExecuteCommand()
 {
     CrmOperationResult commandResponse = null;
     var resultSet = CreateEntityResultSet();
     var response = ExecuteOrganisationRequest();
     commandResponse = new CrmOperationResult(response, resultSet, true);
     DeleteRequest deleteRequest = Request as DeleteRequest;
     // Expose the deleted entities id / name in the result set.
     var deletedEntity = new Entity(deleteRequest.Target.LogicalName);
     deletedEntity.Id = deletedEntity.Id;
     resultSet.Results = new EntityCollection(new List<Entity>(new Entity[] { deletedEntity }));
     return commandResponse;
 }
Пример #4
0
        protected override ICrmOperationResult ExecuteCommand()
        {
            CrmOperationResult commandResponse = null;
            var resultSet = CreateEntityResultSet();
            var response  = ExecuteOrganisationRequest();

            commandResponse = new CrmOperationResult(response, resultSet, true);
            DeleteRequest deleteRequest = Request as DeleteRequest;
            // Expose the deleted entities id / name in the result set.
            var deletedEntity = new Entity(deleteRequest.Target.LogicalName);

            deletedEntity.Id  = deletedEntity.Id;
            resultSet.Results = new EntityCollection(new List <Entity>(new Entity[] { deletedEntity }));
            return(commandResponse);
        }
Пример #5
0
 protected override ICrmOperationResult ExecuteCommand()
 {
     CrmOperationResult commandResponse = null;
     var resultSet = CreateEntityResultSet();
     var response = ExecuteOrganisationRequest();
     commandResponse = new CrmOperationResult(response, resultSet, true);
     if (HasOutput)
     {
         HandleUpdateWithRetreiveResponse(response as ExecuteMultipleResponse, resultSet);
     }
     else
     {
         HandleUpdateResponse(response as UpdateResponse, resultSet);
     }
     return commandResponse;
 }
Пример #6
0
        protected override ICrmOperationResult ExecuteCommand()
        {
            CrmOperationResult commandResponse = null;
            var resultSet = CreateEntityResultSet();
            var response  = ExecuteOrganisationRequest();

            commandResponse = new CrmOperationResult(response, resultSet, true);
            if (HasOutput)
            {
                HandleUpdateWithRetreiveResponse(response as ExecuteMultipleResponse, resultSet);
            }
            else
            {
                HandleUpdateResponse(response as UpdateResponse, resultSet);
            }
            return(commandResponse);
        }
        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);
        }
        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;
        }
        protected override ICrmOperationResult ExecuteCommand()
        {
            CrmOperationResult commandResponse = null;
            var resultSet = CreateEntityResultSet();
            if (IsSchemaOnly())
            {
                commandResponse = new CrmOperationResult(null, resultSet, false);
            }
            else
            {
                var response = ExecuteOrganisationRequest();
                commandResponse = new CrmOperationResult(response, resultSet, false);
                var retrieveMultipleResponse = response as RetrieveMultipleResponse;
                if (retrieveMultipleResponse != null)
                {
                    resultSet.Results = retrieveMultipleResponse.EntityCollection;
                }
            }

            return commandResponse;
        }
Пример #10
0
        protected override ICrmOperationResult ExecuteCommand()
        {
            CrmOperationResult commandResponse = null;
            var resultSet = CreateEntityResultSet();

            if (IsSchemaOnly())
            {
                commandResponse = new CrmOperationResult(null, resultSet, false);
            }
            else
            {
                var response = ExecuteOrganisationRequest();
                commandResponse = new CrmOperationResult(response, resultSet, false);
                var retrieveMultipleResponse = response as RetrieveMultipleResponse;
                if (retrieveMultipleResponse != null)
                {
                    resultSet.Results = retrieveMultipleResponse.EntityCollection;
                }
            }

            return(commandResponse);
        }