奇怪的问题:
尝试对我的电子邮件通知表执行简单查询:
using (MyContext context = new MyContext())
{
IQueryable<EmailNotification> query = context.EmailNotifications.Where(q => (q.LastSendAttemptStatus == EmailNotificationSendStatuses.Pending) || (q.LastSendAttemptStatus == EmailNotificationSendStatuses.Resend));
return query.ToList();
}
即使行存在,也没有结果。实际上,我查看了它生成的SQL并在没有任何更改的情况下运行它,确实带来了正确的结果。
SELECT
[Extent1].[EmailNotificationID] AS [EmailNotificationID],
[Extent1].[From] AS [From],
[Extent1].[To] AS [To],
[Extent1].[Cc] AS [Cc],
[Extent1].[Bcc] AS [Bcc],
[Extent1].[Subject] AS [Subject],
[Extent1].[Body] AS [Body],
[Extent1].[LastSendAttemptOn] AS [LastSendAttemptOn],
[Extent1].[LastSendAttemptStatus] AS [LastSendAttemptStatus],
[Extent1].[FailureComments] AS [FailureComments]
FROM [dbo].[EmailNotifications] AS [Extent1]
WHERE (0 = CAST( [Extent1].[LastSendAttemptStatus] AS int)) OR (3 = CAST( [Extent1]. [LastSendAttemptStatus] AS int))
我应该检查什么提示?
答案 0 :(得分:0)
对不起。结果证明是连接字符串问题。