Open Shaddix opened 7 years ago
Now to sync references you have to do the following: 1) Server-side: have a scalar property with reference's key to pass to the client. E.g.:
[ForeignKey(nameof(ReplyId))] [JsonIgnore] public virtual Message Reply { get; set; } public string ReplyId { get; set; }
That way ReplyId property is synced between the server and the client.
2) Client-side:
[JsonProperty("ReplyId")] [JsonConverter(typeof(RealmReferencesSerializer))] public Message Reply { get; set; }
3) For many-to-many we don't need [JsonProperty] on the client, but we need JsonConverter on the server:
[JsonConverter(typeof(RealmServerCollectionConverter))] public virtual IList<ItemCategory> Categories { get; set; }
Since we control json serialization on both ends, there should not be a need for the user to put in additional attributes
Does it means that I need to use Json attributes in a RealmObject to properly get referenced properties work?
Now to sync references you have to do the following: 1) Server-side: have a scalar property with reference's key to pass to the client. E.g.:
That way ReplyId property is synced between the server and the client.
2) Client-side:
3) For many-to-many we don't need [JsonProperty] on the client, but we need JsonConverter on the server:
Since we control json serialization on both ends, there should not be a need for the user to put in additional attributes