我有这个linq查询: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 };}它有问题。我正在尝试创建任务。对于每个新任务,当我将链接文本设置为恒定字符串(如“ Hello”)时就可以了。但是上面我试图使用发票的属性来构建属性链接文本。我收到此错误:base {System.SystemException} = {“ LINQ to Entities无法识别方法'System.String Format(System.String,System.Object,System.Object)',并且该方法无法转换为商店表达式。” }有人知道为什么吗?有人知道这样做的另一种方法吗?
3 回答
- 3 回答
- 0 关注
- 401 浏览
添加回答
举报
0/150
提交
取消