如何返回包含LINQ to SQLquery结果的列表?我正在尝试这个实现,但我收到了这个错误.
无法隐式转换
'System.Collections.Generic.List<AnonymousType#1>'
为'System.Collections.Generic.List<object>
任何帮助,将不胜感激.
public List<Object> getShoes()
{
var query = from b in db.BrandTbls.AsQueryable()
join m in db.ShoeModelTbls on b.BrandID equals m.BrandID
join s in db.ShoeTbls on m.ModelID equals s.ModelID
join i in db.ShoeImageTbls on s.ShoeID equals i.ShoeID
select new { s.ShoeID, s.Size, s.PrimaryColor, s.SecondaryColor, s.Quantity, m.ModelName, m.Price, b.BrandName, i.ImagePath };
return query.ToList();
}
Run Code Online (Sandbox Code Playgroud)