[CSHARP-4695] Expression not supported: string.Concat Created: 27/Jun/23  Updated: 28/Oct/23  Resolved: 03/Jul/23

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.21.0

Type: Bug Priority: Unknown
Reporter: Oleksandr Poliakov Assignee: Oleksandr Poliakov
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

String.Concat expression is not supported by LInq Provider. Here is the minimal code to reproduce the problem:

 

public class StringConcatTests : Linq3IntegrationTest
{
    [Fact]
    public void String_concat()
    {
        var collection = CreateCollection();
 
        var query = collection.AsQueryable()
            .Where(i => string.Concat(i.A, i.B) == "A1B1");
 
        var results = query.ToList();
 
        results.Should().OnlyContain(i => (i.A + i.B) == "A1B1");
    }
 
    private IMongoCollection<Data> CreateCollection()
    {
        var collection = GetCollection<Data>("test");
        CreateCollection(
            collection,
            new Data { A = "A1", B = "B1" },
            new Data { A = "A2", B = "B2" });
        return collection;
    }
 
    private class Data
    {
        public string A { get; set; }
 
        public string B { get; set; }
    }
} 



 Comments   
Comment by Githook User [ 03/Jul/23 ]

Author:

{'name': 'Oleksandr Poliakov', 'email': '31327136+sanych-sun@users.noreply.github.com', 'username': 'sanych-sun'}

Message: CSHARP-4695: Expression not supported: string.Concat (#1123)
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/b1f4bdec856b877824b12ad7b5a46032d70faf7d

Generated at Wed Feb 07 21:49:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.