Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Framework Core 5.0 does not support string.Concat with more than 2 args #23859

Closed
vsfeedback opened this issue Jan 12, 2021 · 5 comments · Fixed by #23873
Closed

Entity Framework Core 5.0 does not support string.Concat with more than 2 args #23859

vsfeedback opened this issue Jan 12, 2021 · 5 comments · Fixed by #23873
Assignees
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution customer-reported good first issue This issue should be relatively straightforward to fix. type-enhancement
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


A Query similar to:

From t In Me.DataStore.qryAbo
Where t.AboAdrKey = 1035
Order By t.AboActive Descending, t.PrdName, t.TypName
Select New With {t.AboKey, t.AboAdrKey, t.AboActive, . PrdName = String.Concat(t.PrdName, " ", t.TypName, If(t.AboTrial, " (Trial)", ""))}

gets translated to

DECLARE @__DataRow_AdrKey_0 int = 1035;
SELECT [q]. [AboKey], [q]. [AboAdrKey], [q]. [AboActive], [q]. [PrdName], [q]. [TypName], CASE WHEN COALESCE([q].[ AboTrial], CAST(0 AS bit)) = CAST(1 AS bit) THEN N' (Trial)'
    ELSE N''
END
FROM [qryAbo] AS [q]
WHERE COALESCE(CASE
    WHEN ([q].[ AboAdrKey] = @__DataRow_AdrKey_0) AND [q]. [AboAdrKey] IS NOT NULL THEN CAST(1 AS bit)
    ELSE CAST(0 AS bit)
END, CAST(0 AS bit)) = CAST(1 AS bit)
ORDER BY [q]. [AboActive] DESC, [q]. [PrdName], [q]. [TypName]

which brings back 6 columns instead of 4.

Is this by design or should System.Concat be supported?

Thank you for feedback.


Original Comments

May Lei [MSFT] on 12/13/2020, 11:39 PM:

Not sure the area path, please help to reassign if the area path is not correct. Thanks.

Travico Support on 12/15/2020, 05:19 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@smitpatel smitpatel changed the title Entity Framework Core 5.0 does not support System.Concat Entity Framework Core 5.0 does not support string.Concat with more than 2 args Jan 12, 2021
@smitpatel
Copy link
Member

smitpatel commented Jan 12, 2021

We are not capturing overloads which takes 3 & 4 strings as args. Easy to add in relational StringMethodTranslator.
(Also consider translating string.Concat (all overaloads for cosmos)

@smitpatel smitpatel added area-query good first issue This issue should be relatively straightforward to fix. type-enhancement labels Jan 12, 2021
@wmeints
Copy link
Contributor

wmeints commented Jan 13, 2021

I'd like to try and fix this one as a first issue. One question though: What do you mean with the string.Concat overloads for cosmos? Do you have the link to the source file for me where these overloads are located?

@smitpatel
Copy link
Member

@wmeints
Copy link
Contributor

wmeints commented Jan 13, 2021

Sorry, I think I wasn't very clear with my question. I'm looking for the class that translates the String.Concat for the CosmosDB provider. In the mean time I was able to locate the one for the relational provider.

@ajcvickers ajcvickers added this to the 6.0.0 milestone Jan 15, 2021
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jan 26, 2021
@ghost ghost closed this as completed in #23873 Jan 26, 2021
ghost pushed a commit that referenced this issue Jan 26, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0, 6.0.0-preview1 Jan 27, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0-preview1, 6.0.0 Feb 11, 2021
@ajcvickers
Copy link
Member

Looks like this didn't make it into the preview 1 branch. It was merged after preview 1 branched, but before branding was updated to preview 2.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution customer-reported good first issue This issue should be relatively straightforward to fix. type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants