Ton*_*ony 5 c# linq sql-server entity-framework
在我的SQL Server数据库表中,我有binary列类型.
我无法执行查询,为什么?
var data = (from x in model.MyTable
where x.BinaryColumn[0] == 1
select x).FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)
我收到了The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities错误
如果您愿意稍微更改一下查询,这会起作用:
var data = (from x in model.MyTable
where SqlFunctions.CharIndex(new byte[] { 1 }, x.BinaryColumn) == 1
select x).FirstOrDefault();
Run Code Online (Sandbox Code Playgroud)
参见MSDN