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

Predicate translator doesnt support string.Equals with StringComparison argument

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Linq
    • Labels:

      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.

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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'}}");
              }
      

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

              Created:
              Updated:
              Resolved: