Пример #1
0
        /// <summary>
        /// Returns the same collection as the one referenced when the <see cref="ThreadSafeReference.List{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="IList{T}"/> to resolve in this <see cref="Realm"/>.</param>
        /// <typeparam name="T">The type of the objects, contained in the collection.</typeparam>
        /// <returns>
        /// A thread-confined instance of the original <see cref="IList{T}"/> resolved for the current thread or <c>null</c>
        /// if the list's parent object has been deleted after the reference was created.
        /// </returns>
        public IList <T> ResolveReference <T>(ThreadSafeReference.List <T> reference)
        {
            var listPtr    = SharedRealmHandle.ResolveReference(reference);
            var listHandle = new ListHandle(SharedRealmHandle, listPtr);

            if (!listHandle.IsValid)
            {
                return(null);
            }

            return(new RealmList <T>(this, listHandle, reference.Metadata));
        }
Пример #2
0
        /// <summary>
        /// Returns the same collection as the one referenced when the <see cref="ThreadSafeReference.List{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="IList{T}"/> to resolve in this <see cref="Realm"/>.</param>
        /// <typeparam name="T">The type of the object, contained in the collection.</typeparam>
        /// <returns>
        /// A thread-confined instance of the original <see cref="IList{T}"/> resolved for the current thread or <c>null</c>
        /// if the list's parent object has been deleted after the reference was created.
        /// </returns>
        public IList<T> ResolveReference<T>(ThreadSafeReference.List<T> reference) where T : RealmObject
        {
            var listPtr = SharedRealmHandle.ResolveReference(reference);
            var listHandle = new ListHandle(SharedRealmHandle);
            listHandle.SetHandle(listPtr);
            if (!listHandle.IsValid)
            {
                return null;
            }

            return new RealmList<T>(this, listHandle, reference.Metadata);
        }
Пример #3
0
 /// <summary>
 /// Returns the same collection as the one referenced when the <see cref="ThreadSafeReference.List{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="IList{T}"/> to resolve in this <see cref="Realm"/>.</param>
 /// <typeparam name="T">The type of the object, contained in the collection.</typeparam>
 /// <returns>
 /// A thread-confined instance of the original <see cref="IList{T}"/> resolved for the current thread or <c>null</c>
 /// if the list's parent object has been deleted after the reference was created.
 /// </returns>
 public IList <T> ResolveReference <T>(ThreadSafeReference.List <T> reference) where T : RealmObject
 {
     RealmPCLHelpers.ThrowProxyShouldNeverBeUsed();
     return(null);
 }