0
我使用表會議和會話在Azure上建立了數據庫。會話有一個會議的外鍵。在前端,我試圖連接到該數據庫並獲得與外鍵特定會議會話,但是當我嘗試這樣做,我獲得以下問題MobileServiceInvalidOperationException使用LINQ連接到Azure的Xamarin.Forms
我的代碼:
// Return Sessions of the current conference
public async Task<ObservableCollection<Session>> GetSessionsAsync(Conference currentConference, bool syncItems = false)
{
try
{
IEnumerable<Session> sessions = await sessionTable
//problem is here .Where(s => s.ConferenceId == currentConference.Id)
.ToEnumerableAsync();
return new ObservableCollection<Session>(sessions);
}
catch (MobileServiceInvalidOperationException msioe)
{
Debug.WriteLine(@"MSIOE exception: {0}", msioe.Message);
}
catch (Exception e)
{
Debug.WriteLine(@"Some exception: {0}", e.Message);
}
return null;
}
最有趣的事情是,如果我的問題串後寫
Debug.WriteLine(sessions.First().ConferenceId == currentConference.Id);
(它的工作原理沒有LINQ「去哪兒」),這將顯示「TRU E」。
即使我在問題字符串之後使用linq表達式,它們也能正常工作。如果我使用where子句而不是列ConferenceId
它也適用於我。
P.S.在調試窗口我看到MSIOE例外