LINQ to Entities does not recognize the method 'System.String[] Split(Char[])' method,

前端 未结 6 1982
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 02:17

I am trying to implement a method where the keywords stored in the database for an activity (split by a comma) match the giving string split by a comma.

publ         


        
6条回答
  •  心在旅途
    2020-12-04 02:22

    Not sure but you can try: Since the error appears to be looking for an array this might work.

    string[] keyword = keywords.Split(new char[] {','});
    
    var results  = (from a in Entities.TblActivities
                    where a.Keywords.Split(new char[] {','}).Any(p => keyword.Contains(p))
                    select a).ToList();
    

提交回复
热议问题