1

我写了这个:


var destinations = db.DestinationDetails.
    Where(dd => dd.Language.Lang == "en-US" &&
        dd.Destination.Client.Any(c => c.Email == "abc@yahoo.com"));

如何检索电子邮件 abc@yahoo.com 的客户没有的 destinationDetails?

这不起作用:


var destinations = db.DestinationDetails.
    Where(dd => dd.Language.Lang == "en-US" &&
        dd.Destination.Client.Any(c => c.Email != "abc@yahoo.com"));

谢谢!

4

3 回答 3

4

我认为您想使用 All 而不是 Any:

dd.Destination.Client.All(c => c.Email != "abc@yahoo.com")
于 2009-03-21T09:01:32.960 回答
2

尝试

var destinations = db.DestinationDetails.
    Where(dd => dd.Language.Lang == "en-US" &&
        !dd.Destination.Client.Any(c => c.Email == "abc@yahoo.com"));
于 2009-03-21T09:04:12.097 回答
1
var destinations =(db.DestinationDetails.
    Where(dd => dd.Language.Lang == "en-US" &&
    dd.Destination.Client.Any(c => c.Email != "abc@yahoo.com")).Select c).ToList();

试试这个,你可能会得到结果...

于 2012-05-09T06:33:25.620 回答