Subscribe To Many


#1

I noticed that something like this doesn’t work unless you explicitly subscribe to the To-Many Realm Object first. Is that correct?

Tally = new ObservableCollection(Person.Votes);


#2

You’ll need to be more specific for us to meaningfully help you - what do you expect to happen with this code? I imagine Person.Votes is IList<Something>, which means that the observable collection will simply copy the elements in its internal storage and disregard the original collection after that. Why do you need to create an observable collection from that list?


#3

I am using Observable because I think votes will change over time and that has worked for me listening to changes in the GridView control.

But from a high level overview, I want to subscribe to 1 person or user_account realm object when authenticating and have the To-Many relationship internal storage data initialized from the Realm Cloud.

For Example, in your quick journal sample project if I pass a user_account object into a view model all I would need to do is:

JournalEntrys = new ObservableCollection(UserAccount. JournalEntrys);

If I need to demoralize the user_account id fields to the To Many Realm Object’s then I would need to subscribe with a Query by the user_id

Entries = _realm.All().Where…


#4

My point was more toward the fact Realm already emits collection change notifications for collection properties - e.g. Person.Votes already implements INotifyCollectionChanged, so there’s no need to wrap it into an ObservableCollection.