Skip to content

Unexpected behavior of JoinOperator MatchFirstRowUsingCrossApply: ignores EntityAlias and returns columns in PascalCase #519

@jordimontana82

Description

@jordimontana82

Not sure if this is the best repo, but when playing with one of the newer join operators, the query below ignores the EntityAlias of the LinkEntity and also returns the column name in Pascal Case ("Name") as opposed to "name".

This is different to the behaviour of other join types (i.e. inner or left outer).

Is this expected?

        [Fact]
        public void Should_return_contact_with_cross_apply_operator_that_matches_first_contoso_account_record()
        {
            var query = new QueryExpression("contact")
            {
                ColumnSet = new ColumnSet("firstname")
            };

            var linkedEntity = new LinkEntity(
                        linkFromEntityName: "contact",
                        linkToEntityName: "account",
                        linkFromAttributeName: "contactid",
                        linkToAttributeName: "primarycontactid",
                        joinOperator: JoinOperator.MatchFirstRowUsingCrossApply)
            {
                Columns = new ColumnSet("name"),
                LinkCriteria = new FilterExpression(filterOperator: LogicalOperator.And)
                {
                    Conditions = {
                                new ConditionExpression(
                                    attributeName: "name",
                                    conditionOperator: ConditionOperator.BeginsWith,
                                    value: "Con")
                            }
                }
            };
            linkedEntity.EntityAlias = "account";
            query.LinkEntities.Add(linkedEntity);

            var result = _service.RetrieveMultiple(query);
            Assert.Single(result.Entities);
            Assert.Equal("Joe", result.Entities[0]["firstname"]);
            Assert.Equal("Contoso", result.Entities[0]["account.name"]); //Fails as it just returns the value in a "Name" attribute
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions