mam tej kwerendy LINQ:LINQ do podmiotów nie rozpoznaje metoda 'system.string Format (System.String, System.Object, System.Object)'
private void GetReceivedInvoiceTasks(User user, List<Task> tasks)
{
var areaIds = user.Areas.Select(x => x.AreaId).ToArray();
var taskList = from i in _db.Invoices
join a in _db.Areas on i.AreaId equals a.AreaId
where i.Status == InvoiceStatuses.Received && areaIds.Contains(a.AreaId)
select new Task {
LinkText = string.Format(Invoice {0} has been received from {1}, i.InvoiceNumber, i.Organisation.Name),
Link = Views.Edit
};
}
Ma problemy chociaż. Próbuję tworzyć zadania. Dla każdego nowego zadania, gdy ustawiam tekst linku na ciąg stały taki jak "Cześć", wszystko jest w porządku. Jednak powyżej staram się zbudować linktekst nieruchomości za pomocą właściwości faktury.
otrzymuję ten błąd:
base {System.SystemException} = {"LINQ to Entities does not recognize the method 'System.String Format(System.String, System.Object, System.Object)' method, and this method cannot be translated into a store expression."}
ktoś wie dlaczego? Czy ktoś wie, jak to zrobić, aby to zadziałało?
Tak, brakowało że z pierwotnie – AnonyMouse
możliwy duplikat [LINQ podmiotom nie rozpoznaje metody „system.string toString()” metoda] (http://stackoverflow.com/questions/4121863/linq- do-encji-nie-rozpoznaje-metody-system-string-tostring-method) –