Predicate translator doesnt support string.Equals with StringComparison argument

XMLWordPrintableJSON

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

      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 Stam
              Reporter:
              Alexey N/A
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: