Split string with LINQ

I want to order, according to my results, the number of matches in a row string.

So here is the code

.ThenByDescending(p => p.Title.ToLower()
                              .Split(' ')
                              .Count(w => words.Any(w.Contains)));

But this brings me an error and says that LINQ cannot parse Splitinto SQL.

LINQ to Entities does not recognize the method 'System.String [] Split (Char [])' method, and this method cannot be translated into a stored expression.

How can I implement Split via LINQ?

For example, for this array, it must be ordered in this way

words = { "a", "ab" }

ab a ggaaag gh //3 matches
ba ab ggt //2 matches
dd //0 matches
+5
source share
3 answers

, Linq split, sql-. , , ToList(), AsEnumerable() ..

var result = (from t in db.Table
              select t).AsEnumerable().OrderBy(x=>x.Column).ThenByDescending(p=>p.Title.ToLower.Split(' ')....);
+8

LINQ , LINQ to Entities # SQL ( ).

.

var results = 
  objectContext
  .Where(a => a == b) //Whatever
  .AsEnumerable()
  .ThenByDescending(p=>p.Title.ToLower().Split(' ').Count(w=>words.Any(w.Contains)));

AsEnumerable() ( ToArray() ToList()) LINQ LINQ to Objects.

+2

, LINQ to Entities SQL.

, ( ). () FK.

, , . . .

( ), , - , LINQ , @Muhammad Adeel Zahid.

+2

All Articles