我有:
private Dictionary<int, ?olor[]> colorSet = new Dictionary<int, ?olor[]>()
{
{1, new ?olor[2] {?olor.Red, ?olor.Green}},
{2, new ?olor[2] {?olor.Yellow, ?olor.Blue}},
...
};
public class Graph
{
public ?olor ?olor { get; set; }
public ICollection<Point> Points { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
1)我如何List<Graph>从数据库中获取Points非空的?
List<Graph> graphs = context.Graphs.Where(g => g.Points.Count > 0).ToList()
Run Code Online (Sandbox Code Playgroud)
2)如何执行?
List<Graph> graphs = context.Graphs.Where(g => colorSet[1].Contains(g.Color)).ToList()
Run Code Online (Sandbox Code Playgroud)
例外是:
LINQ to Entities无法识别方法'...'方法,并且此方法无法转换为商店表达式.