我有一个Linq查询,它将选择我的InventoryLocation表中的所有记录。但是它给了我一个错误...我不知道问题出在哪里...我真的很新,所以请谅解...
错误
提前感谢。无法隐式转换类型System.Linq.IQueryable到System.Collections.Generic.IEnumerable
public IEnumerable<InventoryLocationModel> GetInventoryLocations()
{
IEnumerable<InventoryLocationModel> results = null;
using (DataContext ctx = new DataContext())
{
results = from a in ctx.InventoryLocations select a;
}
return results;
}
results = (from a in ctx.InventoryLocations select a).AsEnumerable<InventoryLocationModel>();
- Mark C.DataContext.InventoryLocations
的返回类型是什么? - jdphenix