-
Hi, Trying to use Realm in a dotnet application, I need to be notified about changes in a Realm query to monitor new/updated/deleted objects. I need to be able, among other things, to determine which objects have changed, and which changes have occurred in these objects. To that extend, I try to properly use the My first issue is when looking at the documentation: I find two conflicting descriptions for the
Having debugged my application, I find that the first description seems to be the correct one. The second issue I have is with the last remark for
How can the notification with the initial collection be coalesced with subsequent changes notifications, as the two types of notifications rely on the Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 13 replies
-
Hi @jrlaff, you're right that the documentation could be clearer on how to interpret the different variables of the notification callback. The |
Beta Was this translation helpful? Give feedback.
-
Hi @jrlaff, Just to add a little more info on the subject.
So there's no conflicting description. In
Concluding, you should always check for About the second issue, as written in the reference, I hope this helps to get even more insight on the matter. Andrea |
Beta Was this translation helpful? Give feedback.
-
Might be worthy of creating a separate issue, but there are two more uncertain areas regarding this function's usage:
|
Beta Was this translation helpful? Give feedback.
-
I have one more general question regarding the usage of Is it safe to assume that there is no guarantee of when the notifications are delayed by realm? From another angle, here's what I'm working with and why I bring up this question: I am looking at a real-world example where we have a file lookup component that is caching realm results to a dictionary (because realm lookups are too slow for our purposes in this specific use case, with hundreds or thousands of lookup on string filename = "user_import.jpg";
realmObject.Files.Add(new File(filename)); // a new file is imported by a user interaction
// the file lookup cache is watching for changes to `realmObject` in the background and invalidated its cache on seeing any change
syncContext.Post(() =>
{
// internally, Sprite uses DI to access the file lookup cache and query for filename.
// so we need to be sure that the realm notification has arrived before running this call.
// posting to the active syncContext isn't enough, as realm may not have updated yet.
placeObject(new Sprite(filename));
}); Curious if there is a recommended way to handle this kind of flow. Basically, we want to know when realm has finished synchronising and propagating the callbacks. Calling |
Beta Was this translation helpful? Give feedback.
-
One more question: If a transaction is doing both a modification and a deletion, both of which are going to fire a callback from a |
Beta Was this translation helpful? Give feedback.
Hi @jrlaff,
Just to add a little more info on the subject.
About your first question you can find an answer in the remarks of SubscribeForNotifications(NotificationCallbackDelegate). Just a little after the sentence you quoted. It says:
So there's no conflicting description. In
NotificationCallbackDelegate<T>
,changes
is always null the first time you receive the notification. Afterwards it contains the changes that happened. At the same time,error
isnull
if no errors have occurred, otherwise it holds info about the exception. So it would be like the following:c…