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

Predicate translator doesnt support string.Equals with StringComparison argument

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Linq

    Description

      Hi, I from the nopCommerce team, and we want to add support MongoDB but really can't do it now because the Linq component has bugs, and it isn't flexible at all.

      Predicate translator doesn't support string.Equals with StringComparison argument
      I have some code for a pull request to fix the test below.

      public void StringEqualsMethodWithStringComparisonArgument()
              {
                  Assert(
                      x => x.A.Equals("Awesome", StringComparison.InvariantCultureIgnoreCase),
                      1,
                      "{A: /^Awesome$/i}");
       
                  Assert(
                      x => !"Awesome".Equals(x.A, StringComparison.OrdinalIgnoreCase),
                      1,
                      "{A: {$not: /^Awesome$/i}}");
       
                  Assert(
                      x => "Awesome".Equals(x.A, StringComparison.Ordinal),
                      1,
                      "{A: 'Awesome'}");
       
                  Assert(
                      x => !x.A.Equals("Awesome", StringComparison.InvariantCulture),
                      1,
                      "{A: {$ne: 'Awesome'}}");
              }
      

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            exile.developer@gmail.com Alexey N/A
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: