【发布时间】:2017-10-21 00:11:56
【问题描述】:
我有一个 Azure 移动 Easy Table Xamarin 应用程序,它是一堆列表,用于提醒自己。添加,更新和删除工作正常。我希望能够获得软删除项目的列表,这样我就可以取消删除一些以将它们重新添加到列表中而无需重新键入它们。我无法弄清楚如何做到这一点。我在 Google 搜索中看到 IncludeDeleted 属性,但它似乎不适用于我正在使用的 IMobileServiceSyncTable 表。这是代码,但它检索零记录。如果我在 LinqPad 5 中运行它,我会得到所有软删除的记录。
public async Task<IEnumerable<ListData>> GetDeletedItemsAsync()
{
await InitializeClient();
await SyncItems();
try
{
IEnumerable<ListData> items = await listdata
.Where(listdata => listdata.Deleted == true )
.ToEnumerableAsync();
return new ObservableCollection<ListData>(items);
}
catch (MobileServiceInvalidOperationException msioe)
{
Debug.WriteLine(@"Invalid sync operation: {0}", msioe.Message);
}
catch (Exception e)
{
Debug.WriteLine(@"Sync error: {0}", e.Message);
}
return null;
}
这是类:
public class ListData
{
public string id { get; set; }
[JsonProperty(PropertyName = "listname")]
public string ListName { get; set; }
[JsonProperty(PropertyName = "itemdata")]
public string ItemData { get; set; }
[JsonProperty(PropertyName = "itemdetail")]
public string ItemDetail { get; set; }
[JsonProperty(PropertyName = "deleted")]
public Boolean Deleted { get; set; }
// *** Enable Optimistic Concurrency *** //
[Version]
public string Version { get; set; }
}
我错过了什么?谢谢。
【问题讨论】:
标签: sqlite azure xamarin soft-delete