我使用EF4.0在我的脑海中做了一个非常基本的查询。我已经确认我的表中的所有列引用都是Int(我们不使用bigint或smallint)所以我排除了这一点。我已经尝试将类型更改为Int64,然后它抱怨转换为Int32。这让我相信“问题不是问题”类型的情况。什么是EF系统抱怨?
public class clsResult
{
public Int32 PkId { get; set; }
public Int32 FkId { get; set; }
public Int32 Threshold { get; set; }
}
var qry = db.ExecuteStoreQuery<clsResult>(@"SELECT PkId, FkId, Threshold
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY FkId ORDER BY PkId ASC) AS Threshold, *
FROM ClientTrans
) AS T1
WHERE (Threshold <= 3)
AND (ClientID IN ( SELECT Id
FROM ClientProfile
WHERE (p.Login LIKE 'WEBS%')))
AND (DateRpt >= @STARTDATE)
AND (DateRpt <= @ENDDATE)", SqlParams).ToList();
错误产生: 从物化的“System.Int64”类型到“System.Int32”类型的指定强制转换无效。