2017-03-02 82 views
0

我的代码是:错误无法投类型System.Collections.Generic.List的对象键入System.Linq.IQueryable

'GET:的OData/Event_Game_Schedule

<EnableQuery> 
    Function GetEvent_Game_Schedule() As IQueryable(Of Event_Game_Schedule) 
     Dim schedule As New List(Of Event_Game_Schedule) 
     schedule = db.Event_Game_Schedule.ToList() 
     For Each x As Event_Game_Schedule In schedule 
      x.hometeamid = (From t In db.Teams Where t.id = x.hometeamid Select t.name).FirstOrDefault 
      x.visitorteamid = (From t In db.Teams Where t.id = x.visitorteamid Select t.name).FirstOrDefault 
     Next 

     Return schedule.AsQueryable.ToList() 
    End Function 

我在做什么错..这是一个控制器,我想返回团队的名称而不是API中的teamid。

感谢

+0

这不看起来像VBA - 因为当VBA有像List(Of ...)'和'Return'这样的东西吗?我是否需要挖掘手册并修改最新版本中的更改? – YowE3K

回答

0

我发现我只需要添加AsQueryable已部分答案..不是.ToList()

这是Visual Basic的一个vb.net项目

相关问题