Let's say we have the following entity (I use EF6):
Code: Select all
public class MyEntity
{
public Guid Id { get; set; }
public String Name { get; set; }
public Int32 Category { get; set; }
public String Directions { get; set; }
}
Code: Select all
MyEntity.Directions = "East, North, South";
Code: Select all
var result = MyDBContext.MyEntites.Where(e => (e.Category == 123) && (e.Directions.Split(',').Contains("East")).Tolist()
The only workaround for now is to switch from Linq to Entites to Linq to Objects via .AsEnumerable() method:
Code: Select all
var result = MyDBContext.MyEntites.Where(e => e.Category == 123).AsEnumerable().
Where(e => e.Directions.Split(',').Contains("East")).Tolist()
So is it possible to get the first query work (maybe with the hel of SQLiteFunctions class)?
P. S. If it will be easier to implement I can replace String Directions -> "East, North, South" with Int32 DirectionCodes -> "0, 2, 3" and filter by Int32 value.