linq 'not in' query not resolving to what I expect
- by Fiona
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