尝试运行时出现错误:
Nullable<Guid> ng = corpid;
var qry1 = from c in entities.Transactions
join p in entities.Products on c.CorporationId equals (Nullable<Guid>) p.CorporationId
where c.Branch == br &&
c.AccountNumber == accountnumber &&
c.CorporationId == ng
orderby c.TransactionDate descending
select new
{
Date = c.TransactionDate,
RefNo = c.ReferenceNumber,
DlvryAcct = c.DeliveryAccount,
Desc = p.Description,
GasQty = c.GasQuantity,
Total = c.Amount,
Balance = c.Balance
};
这是消息:
LINQ to Entities 无法识别该方法 'System.Linq.IQueryable`1[f__AnonymousType1`7[System.Nullable`1[System.DateTime], System.String,System.String,System.String,System.Nullable`1[System.Decimal], System.Nullable`1[System.Decimal],System.Nullable`1[System.Decimal]]] 反向[f__AnonymousType1`7](System.Linq.IQueryable`1[f__AnonymousType1`7[System.Nullable`1[System.DateTime], System.String,System.String,System.String,System.Nullable`1[System.Decimal], System.Nullable`1[System.Decimal],System.Nullable`1[System.Decimal]]])' 方法,并且该方法不能翻译成商店表达式。
我认为可空 guid 的强制转换在这里不起作用。Thec.CorporationId
是一个可为空的 guid,但 thep.corporationid
只是一个 guid。
有什么建议么?