LinqToQuerystring icon indicating copy to clipboard operation
LinqToQuerystring copied to clipboard

String functions startswith and endswith don't work properly with apostrophe

Open vkagamlyk opened this issue 10 years ago • 0 comments

I tried different escape sequences, no one work. LinqToQuerystringFilteringSample also don't allow search by apostrophe, crashes with exception.

Simple test (nunit) [Test] [TestCase("'", Result = 1)] [TestCase("\'", Result = 1)] [TestCase("''''", Result = 1)] [TestCase("''", Result = 1)] [TestCase(""", Result = 1)] public int QueryWithApostrophe(string query) { var data = new Data[] { new Data("'hello"), new Data("one"), new Data("two"), new Data("three") };

        var result = data.AsQueryable().LinqToQuerystring(typeof(Data), "?$filter=startswith(tolower(Title),tolower('" + query + "')) eq true");

        return (result as IEnumerable<Data>).Count();
    }

vkagamlyk avatar Jul 17 '15 15:07 vkagamlyk