Edmx 文件有
<Property Name="SomePrimaryKeyID" Type="bigint" />
对应对象的属性是
<Property Type="Int64" Name="SomePrimaryKeyID" Nullable="false" />
询问:
long[] ids = new long[]{1234567,1234568};
var results = context.SomeEntities.Where(x=> ids.Contains(x.SomePrimaryKeyID)).ToList();
当我使用包含时,EF 生成的查询具有显式转换,例如
... WHERE SomePrimaryKeyID IN (CAST (1234567 AS BIGINT),CAST (1234568 AS BIGINT))
由于 long 对应于 bigint,我认为不需要强制转换。有没有办法可以避免这种演员?