Convert() 개인적인 메소드

private Convert ( Exception>.Func overrider = null ) : Exception
overrider Exception>.Func
리턴 System.Exception
        void NotificationsHelper.INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet?changes, NativeException?exception)
        {
            var       managedException = exception?.Convert();
            ChangeSet changeset        = null;

            if (changes != null)
            {
                var actualChanges = changes.Value;
                changeset = new ChangeSet(
                    insertedIndices: actualChanges.Insertions.AsEnumerable().Select(i => (int)i).ToArray(),
                    modifiedIndices: actualChanges.Modifications.AsEnumerable().Select(i => (int)i).ToArray(),
                    newModifiedIndices: actualChanges.Modifications_New.AsEnumerable().Select(i => (int)i).ToArray(),
                    deletedIndices: actualChanges.Deletions.AsEnumerable().Select(i => (int)i).ToArray(),
                    moves: actualChanges.Moves.AsEnumerable().Select(m => new ChangeSet.Move((int)m.From, (int)m.To)).ToArray());
            }
            else
            {
                _deliveredInitialNotification = true;
            }

            foreach (var callback in _callbacks.ToArray())
            {
                callback(this, changeset, managedException);
            }
        }
예제 #2
0
        void NotificationsHelper.INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet?changes, NativeException?exception)
        {
            var managedException = exception?.Convert();

            if (managedException != null)
            {
                Realm.NotifyError(managedException);
            }
            else if (changes.HasValue)
            {
                foreach (int propertyIndex in changes.Value.Properties.AsEnumerable())
                {
                    // Due to a yet another Mono compiler bug, using LINQ fails here :/
                    var i = 0;
                    foreach (var property in ObjectSchema)
                    {
                        // Backlinks should be ignored. See Realm.CreateRealmObjectMetadata
                        if (property.Type.IsComputed())
                        {
                            continue;
                        }

                        if (i == propertyIndex)
                        {
                            RaisePropertyChanged(property.PropertyInfo?.Name ?? property.Name);
                            break;
                        }

                        ++i;
                    }
                }
            }
        }
예제 #3
0
        void NotificationsHelper.INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet?changes, NativeException?exception)
        {
            var managedException = exception?.Convert();

            if (managedException != null)
            {
                Realm.NotifyError(managedException);
            }
            else if (changes.HasValue)
            {
                foreach (var propertyIndex in changes.Value.Properties.AsEnumerable())
                {
                    var property = ObjectSchema.ElementAtOrDefault((int)propertyIndex);
                    RaisePropertyChanged(property.PropertyInfo?.Name ?? property.Name);
                }
            }
        }
예제 #4
0
        /// <inheritdoc/>
        void INotifiable <NotifiableObjectHandleBase.CollectionChangeSet> .NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet?changes, NativeException?exception)
        {
            var managedException = exception?.Convert();

            if (managedException != null)
            {
                Realm.NotifyError(managedException);
            }
            else if (changes.HasValue)
            {
                foreach (int propertyIndex in changes.Value.Properties.AsEnumerable())
                {
                    // Due to a yet another Mono compiler bug, using LINQ fails here :/
                    var i = 0;
                    foreach (var property in ObjectSchema)
                    {
                        // Backlinks should be ignored. See Realm.CreateRealmObjectMetadata
                        if (property.Type.IsComputed())
                        {
                            continue;
                        }

                        if (i == propertyIndex)
                        {
                            RaisePropertyChanged(property.PropertyInfo?.Name ?? property.Name);
                            break;
                        }

                        ++i;
                    }
                }

                if (changes.Value.Deletions.AsEnumerable().Any())
                {
                    RaisePropertyChanged(nameof(IsValid));

                    if (!IsValid)
                    {
                        // We can proactively unsubscribe because the object has been deleted
                        UnsubscribeFromNotifications();
                    }
                }
            }
        }
예제 #5
0
        void RealmResultsNativeHelper.Interface.NotifyCallbacks(ResultsHandle.CollectionChangeSet?changes, NativeException?exception)
        {
            var       managedException = exception?.Convert();
            ChangeSet changeset        = null;

            if (changes != null)
            {
                var actualChanges = changes.Value;
                changeset = new ChangeSet(
                    insertedIndices: actualChanges.Insertions.AsEnumerable().Select(i => (int)i).ToArray(),
                    modifiedIndices: actualChanges.Modifications.AsEnumerable().Select(i => (int)i).ToArray(),
                    deletedIndices: actualChanges.Deletions.AsEnumerable().Select(i => (int)i).ToArray());
            }

            foreach (var callback in _callbacks)
            {
                callback(this, changeset, managedException);
            }
        }
예제 #6
0
        void INotifiable <DictionaryHandle.DictionaryChangeSet> .NotifyCallbacks(DictionaryHandle.DictionaryChangeSet?changes, NativeException?exception)
        {
            var managedException          = exception?.Convert();
            DictionaryChangeSet changeset = null;

            if (changes != null)
            {
                var actualChanges = changes.Value;
                changeset = new DictionaryChangeSet(
                    insertedKeys: actualChanges.Insertions.AsEnumerable().Select(v => v.AsString()).ToArray(),
                    modifiedKeys: actualChanges.Modifications.AsEnumerable().Select(v => v.AsString()).ToArray());
            }
            else
            {
                _deliveredInitialKeyNotification = true;
            }

            foreach (var callback in _keyCallbacks.ToArray())
            {
                callback(this, changeset, managedException);
            }
        }
예제 #7
0
 public static void ExceptionThrower(NativeException exception)
 {
     throw exception.Convert();
 }