linq 'not in' query not resolving to what I expect
Posted
by
Fiona
on Stack Overflow
See other posts from Stack Overflow
or by Fiona
Published on 2012-06-29T09:11:42Z
Indexed on
2012/06/29
9:15 UTC
Read the original article
Hit count: 237
LINQ
I've written the following query in Linq:
var res = dc.TransactionLoggings
.Where(
x => !dc.TrsMessages(y => y.DocId != x.DocId)
).Select(x => x.CCHMessage).ToList();
This resolves to the following:
SELECT [t0].[CCHMessage]
FROM [dbo].[TransactionLogging] AS [t0]
WHERE NOT (EXISTS(
SELECT NULL AS [EMPTY]
FROM [dbo].[TrsMessages] AS [t1]
WHERE [t1].[DocId] <> [t0].[DocId]
))
Which always returns null
Basiaclly what I'm trying to write is the following Select cchmessage from transactionlogging where docid not in (select docid from trsmessages)
Any suggestions on what's wrong with my LINQ statment?
Many thanks, Fiona
© Stack Overflow or respective owner