【发布时间】:2013-04-17 15:23:01
【问题描述】:
这是我的代码:
public IEnumerable<IUIUPCItemShort> GetActiveWithDefaultCost()
{
var query = from upc in DataManagerFactory.Get().Manage<IUPCItem>().GetAll()
join inv in DataManagerFactory.Get().Manage<IInventory>().GetAll() on upc.UPCID equals inv.UPCID
where inv.ExitDate == null
&& upc.UnitCost == null
select upc;
return
query.Cast<IUIUPCItemShort>().ToList();
基本上,我正在尝试在 UPC 和 Inventory 两个表之间进行联接,并且希望仅列出满足 WHERE 条件的 UPC 列表,因为我只想显示用户UPC 的列表。我显然做错了什么,因为我收到了这条消息:
无法将“System.Linq.Expressions.MethodCallExpressionN”类型的对象转换为“SubSonic.Linq.Structure.ProjectionExpression”类型。
我认为问题出在我的 Linq 代码中,特别是在 select upc;
我该如何做我想要完成的事情?
谢谢。
【问题讨论】: