[英]No 'id' member found on type 'PackingList.Models.Reis' : UWP (Windows 10 app)
public sealed partial class Login : Page
{
public MobileServiceClient client = App.MobileService;
public IMobileServiceTable<Reis> reisTable = App.MobileService.GetTable<Reis>();
public Login()
{
this.InitializeComponent();
}
// Define a member variable for storing the signed-in user.
private MobileServiceUser user;
// Define a method that performs the authentication process
// using a Facebook sign-in.
private async System.Threading.Tasks.Task<bool> AuthenticateAsync()
{
string message;
bool success = false;
try
{
// Change 'MobileService' to the name of your MobileServiceClient instance.
// Sign-in using Facebook authentication.
user = await App.MobileService
.LoginAsync(MobileServiceAuthenticationProvider.Facebook);
message =
string.Format("You are now signed in - {0}", user.UserId);
success = true;
}
catch (InvalidOperationException)
{
message = "You must log in. Login Required";
}
var dialog = new MessageDialog(message);
dialog.Commands.Add(new UICommand("OK"));
await dialog.ShowAsync();
return success;
}
private async void ButtonLogin_Click(object sender, RoutedEventArgs e)
{
// Login the user and then load data from the mobile app.
if (await AuthenticateAsync())
{
Frame rootFrame = Window.Current.Content as Frame;
ButtonLogin.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
rootFrame.Navigate(typeof(MainPage));
}
}
}
在代碼的“ public IMobileServiceTable reisTable”行上引發錯誤,在“ PackingList.Models.Reis”類型上找不到“ id”成員。
這是我們的雷斯課程:
public class Reis
{
[JsonProperty(PropertyName="userID")]
public string UserID { get; set; }
[JsonProperty(PropertyName = "name")]
public string Title { get; set; }
[JsonProperty(PropertyName = "departureDate")]
public DateTime DepartureDate { get; set; }
[JsonProperty(PropertyName = "location")]
public String Location { get; set; }
[JsonProperty(PropertyName = "items")]
List<ReisItem> ReisItems { get; set; }
[JsonProperty(PropertyName = "taken")]
List<Taak> Taken { get; set; }
}
我嘗試在線搜索一些示例或解決方案,但找不到確鑿證據證明我們在做什么和在哪里做錯了。 我們的azure服務(在線數據庫)給出以下錯誤:
我們不知道我們的錯在哪里。
移動服務客戶端SDK當前要求您的模型具有一個名為Id(id,Id或ID)的屬性(JSON屬性),而上面的對象沒有。
將該屬性添加到類型中應該可以解決該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.