/// <summary> /// Returns the same object as the one referenced when the <see cref="ThreadSafeReference.Object{T}"/> was first created, /// but resolved for the current Realm for this thread. /// </summary> /// <param name="reference">The thread-safe reference to the thread-confined <see cref="RealmObject"/> to resolve in this <see cref="Realm"/>.</param> /// <typeparam name="T">The type of the object, contained in the reference.</typeparam> /// <returns> /// A thread-confined instance of the original <see cref="RealmObject"/> resolved for the current thread or <c>null</c> /// if the object has been deleted after the reference was created. /// </returns> public T ResolveReference <T>(ThreadSafeReference.Object <T> reference) where T : RealmObject { var objectPtr = SharedRealmHandle.ResolveReference(reference); var objectHandle = new ObjectHandle(SharedRealmHandle, objectPtr); if (!objectHandle.IsValid) { return(null); } return((T)MakeObject(reference.Metadata, objectHandle)); }
/// <summary> /// Returns the same object as the one referenced when the <see cref="ThreadSafeReference.Object{T}"/> was first created, /// but resolved for the current Realm for this thread. /// </summary> /// <param name="reference">The thread-safe reference to the thread-confined <see cref="RealmObject"/> to resolve in this <see cref="Realm"/>.</param> /// <typeparam name="T">The type of the object, contained in the reference.</typeparam> /// <returns> /// A thread-confined instance of the original <see cref="RealmObject"/> resolved for the current thread or <c>null</c> /// if the object has been deleted after the reference was created. /// </returns> public T ResolveReference <T>(ThreadSafeReference.Object <T> reference) where T : RealmObject { RealmPCLHelpers.ThrowProxyShouldNeverBeUsed(); return(null); }