0

奇怪的问题:

尝试对我的电子邮件通知表进行简单查询:

        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))

关于我应该检查什么的任何提示?

4

1 回答 1

0

非常遗憾。原来是连接字符串问题。

于 2013-02-18T11:09:13.280 回答