EF6
Hej,Jeg bruger EF6 og LINQ til at hente data fra min lokale sql db.
IEnumerable<TransactionEntry> es = ctx.TransactionEntries.Include(e => e.Transaction).Where(e => e.ColonyId == colonyId && e.AccountId == accountId);
es = es.Where(e => e.Transaction.Date <= DateTime.Today);
es.Sum(e => e.Amount);
Dette bliver konverteret til denne forkerte sql saetning:
SELECT
...
FROM [dbo].[TransactionEntries] AS [Extent1]
INNER JOIN [dbo].[Transactions] AS [Extent2] ON [Extent1].[TransactionId] = [Extent2].[Id]
WHERE ([Extent1].[ColonyId] = @p__linq__0) AND ([Extent1].[AccountId] = @p__linq__1)
Hvor bliver transaction.date filtret af? Hvis jeg omskriver c# til dette, saa virker det?
IEnumerable<TransactionEntry> es = ctx.TransactionEntries.Include(e => e.Transaction).Where(e => e.ColonyId == colonyId && e.AccountId == accountId).Where(e => e.Transaction.Date <= DateTime.Today);
es.Sum(e => e.Amount);
SELECT
...
FROM [dbo].[TransactionEntries] AS [Extent1]
INNER JOIN [dbo].[Transactions] AS [Extent2] ON [Extent1].[TransactionId] = [Extent2].[Id]
WHERE ([Extent1].[ColonyId] = @p__linq__0) AND ([Extent1].[AccountId] = @p__linq__1) AND ([Extent2].[Date] <= @p__linq__2)
Er dette en fejl I EF6, eller goer jeg noget forkert?