-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
Now to sync references you have to do the following:
- 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.
- Client-side:
[JsonProperty("ReplyId")]
[JsonConverter(typeof(RealmReferencesSerializer))]
public Message Reply { get; set; }
- 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