Beispiel #1
0
        static unsafe SharedRealmHandle()
        {
            NativeCommon.Initialize();

            SynchronizationContextScheduler.Install();

            NativeMethods.NotifyRealmCallback                notifyRealm                = NotifyRealmChanged;
            NativeMethods.GetNativeSchemaCallback            getNativeSchema            = GetNativeSchema;
            NativeMethods.OpenRealmCallback                  openRealm                  = HandleOpenRealmCallback;
            NativeMethods.OnBindingContextDestructedCallback onBindingContextDestructed = OnBindingContextDestructed;
            NativeMethods.LogMessageCallback                 logMessage                 = LogMessage;
            NotifiableObjectHandleBase.NotificationCallback  notifyObject               = NotifiableObjectHandleBase.NotifyObjectChanged;
            DictionaryHandle.KeyNotificationCallback         notifyDictionary           = DictionaryHandle.NotifyDictionaryChanged;
            MigrationCallback onMigration = OnMigration;

            GCHandle.Alloc(notifyRealm);
            GCHandle.Alloc(getNativeSchema);
            GCHandle.Alloc(openRealm);
            GCHandle.Alloc(onBindingContextDestructed);
            GCHandle.Alloc(logMessage);
            GCHandle.Alloc(notifyObject);
            GCHandle.Alloc(notifyDictionary);
            GCHandle.Alloc(onMigration);

            NativeMethods.install_callbacks(notifyRealm, getNativeSchema, openRealm, onBindingContextDestructed, logMessage, notifyObject, notifyDictionary, onMigration);
        }
Beispiel #2
0
 public static extern void install_callbacks(
     NotifyRealmCallback notifyRealmCallback,
     GetNativeSchemaCallback nativeSchemaCallback,
     OpenRealmCallback openCallback,
     OnBindingContextDestructedCallback contextDestructedCallback,
     LogMessageCallback logMessageCallback,
     NotifiableObjectHandleBase.NotificationCallback notifyObject,
     DictionaryHandle.KeyNotificationCallback notifyDictionary,
     MigrationCallback onMigration);
Beispiel #3
0
 public static extern void install_callbacks(
     NotifyRealmCallback notify_realm_callback,
     GetNativeSchemaCallback native_schema_callback,
     OpenRealmCallback open_callback,
     OnBindingContextDestructedCallback context_destructed_callback,
     LogMessageCallback log_message_callback,
     NotifiableObjectHandleBase.NotificationCallback notify_object,
     DictionaryHandle.KeyNotificationCallback notify_dictionary,
     MigrationCallback migration_callback,
     ShouldCompactCallback should_compact_callback);
Beispiel #4
0
        public static void Initialize()
        {
            NativeMethods.NotifyRealmCallback                notifyRealm                = NotifyRealmChanged;
            NativeMethods.GetNativeSchemaCallback            getNativeSchema            = GetNativeSchema;
            NativeMethods.OpenRealmCallback                  openRealm                  = HandleOpenRealmCallback;
            NativeMethods.OnBindingContextDestructedCallback onBindingContextDestructed = OnBindingContextDestructed;
            NativeMethods.LogMessageCallback                 logMessage                 = LogMessage;
            NotifiableObjectHandleBase.NotificationCallback  notifyObject               = NotifiableObjectHandleBase.NotifyObjectChanged;
            DictionaryHandle.KeyNotificationCallback         notifyDictionary           = DictionaryHandle.NotifyDictionaryChanged;
            NativeMethods.MigrationCallback                  onMigration                = OnMigration;
            NativeMethods.ShouldCompactCallback              shouldCompact              = ShouldCompactOnLaunchCallback;

            GCHandle.Alloc(notifyRealm);
            GCHandle.Alloc(getNativeSchema);
            GCHandle.Alloc(openRealm);
            GCHandle.Alloc(onBindingContextDestructed);
            GCHandle.Alloc(logMessage);
            GCHandle.Alloc(notifyObject);
            GCHandle.Alloc(notifyDictionary);
            GCHandle.Alloc(onMigration);
            GCHandle.Alloc(shouldCompact);

            NativeMethods.install_callbacks(notifyRealm, getNativeSchema, openRealm, onBindingContextDestructed, logMessage, notifyObject, notifyDictionary, onMigration, shouldCompact);
        }