【发布时间】:2013-09-26 15:08:09
【问题描述】:
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,我认为不需要强制转换。有什么办法可以避免这种演员表吗?
【问题讨论】:
-
显示查询,否则无法判断演员是否可以避免
-
感谢您的提问。也添加了查询。
标签: entity-framework ado.net-entity-data-model entity-framework-6