【发布时间】:2016-07-15 04:24:13
【问题描述】:
我正在使用 Azure 移动应用服务 SDK 中的离线同步功能。
我知道 SDK 最近发生了各种变化。我想根据最新规范定义客户端模型,但不确定要使用哪种类型。
这些是离线同步元数据属性,通常出现在大多数示例/教程中:
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[Version]
public string Version { get; set; }
[CreatedAt]
public DateTimeOffset CreatedAt { get; set; }
[UpdatedAt]
public DateTimeOffset UpdatedAt { get; set; }
[Deleted]
public bool Deleted { get; set; }
但是一些documentation和examples,以及各种官方(太多了!)samples/quickstarts on GitHub,使用了组合类型。
所以我在很多地方也看到过这种情况:
[JsonProperty(PropertyName = "id")]
public Guid Id { get; set; } // Guid is used here, not string
[Version]
[JsonProperty(PropertyName = "version")] // Needed? I assume the attribute is enough
public byte[] Version { get; set; } // byte[] is used here, not string
在幕后一切都是通过 REST 调用和字符串来完成的。所以我假设客户端 SDK 执行各种类型转换。
但我不希望我的应用程序在未来某个时刻发生莫名其妙的轰炸,当事情发生变化时。那么我应该使用哪些官方支持的类型?
【问题讨论】:
标签: c# azure azure-mobile-services