Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4695

Expression not supported: string.Concat

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.21.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Not Needed
    • Hide

      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?

      Show
      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?

      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; }
          }
      } 

            Assignee:
            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            Reporter:
            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: