Ich versuche, die folgende LINQ-Abfrage für die Datenbank zur Arbeit zu kommen (3.5 SP1):Entity Framework BuildContainsExpression Ursachen Interne .NET Framework Data Provider Fehler 1025
var labelIds = new List<int> { 1, 2 };
var customersAggregatedTransactionsByType =
(from transactions in context.TransactionSet
from customers in context.CustomerSet
.Where(LinqTools.BuildContainsExpression<Billing.Customer, int>(u => u.LabelId, labelIds))
from accounts in context.AccountSet
where customers == accounts.Customer
&& accounts.Id == transactions.Account.Id
&& transactions.DateTime >= fromDate && transactions.DateTime < toDate
group transactions.Amount
by new
{
UserAccountId = transactions.Account.Id,
TransactionTypeId = transactions.TransactionTypeId,
BaseAssetId = accounts.BaseAssetId
} into customerTransactions
select customerTransactions).ToList();
Sobald ich hinzufügen Where(LinqTools.BuildContainsExpression<Billing.Customer, int>(u => u.LabelId, labelIds))
ich folgendes erhalten Ausnahme:
System.InvalidOperationException: Interner .NET Framework Data Provider Fehler 1025.
Wenn ich Where(LinqTools.BuildContainsExpression<Billing.Customer, int>(u => u.LabelId, labelIds))
entfernen alles ist gut.
Jede Hilfe wird geschätzt.
Danke, Nir.
Das ist es! Danke vielmals! – nirpi
Oh, du Genie! Ich habe vor einer Stunde ein Kopfgeld auf eine [ähnliche Frage] (http://stackoverflow.com/q/11990158/7850) eröffnet und erst später deine Antwort gefunden. Bitte geh und hol dir eine Prämie drüben. –
Es klingt offensichtlich, aber Sie haben Recht, der Ausdruck muss außerhalb der Abfrage selbst erstellt werden. –