【问题标题】:Azure offline sync of data from 1:n relationship in Android mobile appAzure 离线同步 Android 移动应用中 1:n 关系的数据
【发布时间】:2017-01-15 21:29:51
【问题描述】:

我正在尝试在我的 Android 应用 (Java) 中启用 Azure 离线同步。我在this 文章中添加了与我的云同步 Web 服务 (C#) 具有 1:n 关系的模型:

public class TodoItem : EntityData
{
    public string Text { get; set; }
    public virtual ICollection<Item> Items { get; set; }
}

但是如何在我的客户端应用程序的 Java 代码中设置 1:n 关系?

public class TodoItem {
    @com.google.gson.annotations.SerializedName("id")
    private String mId;
    @com.google.gson.annotations.SerializedName("text")
    private String mText; 
}

是否可以在 Azure 离线同步中实现表关系(服务器端或客户端)?有人成功了吗?

如果是,MobileServiceSyncContext 在推送过程中如何解析表的顺序?我的意思是,如果服务器端(Azure 移动应用)支持关系,而客户端(Android 应用)- 不支持,如果 MobileServiceSyncContext 先推送表项,服务器端会出现数据一致性错误。

如果 Azure 移动应用根本不支持关系(无论是服务器端还是客户端),这意味着我的存储不包含相关表,它只是一堆不相关的表?

【问题讨论】:

    标签: java c# android azure


    【解决方案1】:

    对于Azure移动应用程序上的android客户端,您的场景属于将具有复杂属性或数组属性的对象存储到表中,请参阅Azure官方文档How to: Customize the client部分的How to: Store an object or array property into a table小节来做它。

    作为参考,有一个blog 介绍了如何做到这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-14
      • 1970-01-01
      相关资源
      最近更新 更多