Exemplo n.º 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);
        }
Exemplo n.º 2
0
        internal Exception Convert(Func <RealmExceptionCodes, Exception> overrider = null)
        {
            var message = (messageLength != IntPtr.Zero) ?
                          Encoding.UTF8.GetString(messageBytes, (int)messageLength)
                : "No further information available";

            NativeCommon.delete_pointer(messageBytes);

            return(overrider?.Invoke(type) ?? RealmException.Create(type, message));
        }
Exemplo n.º 3
0
        static Realm()
        {
            RealmObjectClasses = AppDomain.CurrentDomain.GetAssemblies()
                                 .SelectMany(a => a.GetTypes())
                                 .Where(t => t.IsSubclassOf(typeof(RealmObject)))
                                 .ToArray();

            ObjectSchemaCache = new Dictionary <Type, IntPtr>();
            NativeCommon.Initialize();
            NativeCommon.register_notify_realm_changed(NotifyRealmChanged);
        }
Exemplo n.º 4
0
        static Realm()
        {
            NativeCommon.Initialize();

            NativeCommon.NotifyRealmCallback notifyRealm = RealmState.NotifyRealmChanged;
            GCHandle.Alloc(notifyRealm);

            NativeCommon.register_notify_realm_changed(notifyRealm);

            SynchronizationContextEventLoopSignal.Install();
        }
Exemplo n.º 5
0
        static SharedRealmHandle()
        {
            NativeCommon.Initialize();

            NativeMethods.NotifyRealmCallback     notifyRealm     = NotifyRealmChanged;
            NativeMethods.GetNativeSchemaCallback getNativeSchema = GetNativeSchema;

            GCHandle.Alloc(notifyRealm);
            GCHandle.Alloc(getNativeSchema);

            NativeMethods.install_callbacks(notifyRealm, getNativeSchema);
        }
Exemplo n.º 6
0
        static Realm()
        {
            NativeCommon.Initialize();

            NativeCommon.NotifyRealmCallback notifyRealm = RealmState.NotifyRealmChanged;
            GCHandle.Alloc(notifyRealm);

            NativeCommon.GetNativeSchemaCallback getNativeSchema = GetNativeSchema;
            GCHandle.Alloc(getNativeSchema);

            NativeCommon.register_callbacks(notifyRealm, getNativeSchema);

            SynchronizationContextEventLoopSignal.Install();
        }
Exemplo n.º 7
0
        static Realm()
        {
            RealmObjectClasses = AppDomain.CurrentDomain.GetAssemblies()
                                          #if !__IOS__
                                 // we need to exclude dynamic assemblies. see https://bugzilla.xamarin.com/show_bug.cgi?id=39679
                                 .Where(a => !(a is System.Reflection.Emit.AssemblyBuilder))
                                          #endif
                                 .SelectMany(a => a.GetTypes())
                                 .Where(t => t.IsSubclassOf(typeof(RealmObject)))
                                 .ToArray();

            ObjectSchemaCache = new Dictionary <Type, IntPtr>();
            NativeCommon.Initialize();
            NativeCommon.register_notify_realm_changed(NotifyRealmChanged);
        }
        static unsafe SharedRealmHandle()
        {
            NativeCommon.Initialize();

            NativeMethods.NotifyRealmCallback                notifyRealm                = NotifyRealmChanged;
            NativeMethods.GetNativeSchemaCallback            getNativeSchema            = GetNativeSchema;
            NativeMethods.OpenRealmCallback                  openRealm                  = HandleOpenRealmCallback;
            NativeMethods.OnBindingContextDestructedCallback onBindingContextDestructed = OnBindingContextDestructed;

            GCHandle.Alloc(notifyRealm);
            GCHandle.Alloc(getNativeSchema);
            GCHandle.Alloc(openRealm);
            GCHandle.Alloc(onBindingContextDestructed);

            NativeMethods.install_callbacks(notifyRealm, getNativeSchema, openRealm, onBindingContextDestructed);
        }
Exemplo n.º 9
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;

            GCHandle.Alloc(notifyRealm);
            GCHandle.Alloc(getNativeSchema);
            GCHandle.Alloc(openRealm);
            GCHandle.Alloc(onBindingContextDestructed);
            GCHandle.Alloc(logMessage);

            NativeMethods.install_callbacks(notifyRealm, getNativeSchema, openRealm, onBindingContextDestructed, logMessage);
        }
Exemplo n.º 10
0
 static unsafe SharedRealmHandle()
 {
     NativeCommon.Initialize();
 }
Exemplo n.º 11
0
 static Realm()
 {
     NativeCommon.Initialize();
     NativeCommon.register_notify_realm_changed(NotifyRealmChanged);
 }
Exemplo n.º 12
0
 static Realm()
 {
     NativeCommon.Initialize();
     NativeCommon.register_notify_realm_changed(NotifyRealmChanged);
     NativeCommon.register_notify_realm_object_changed(RealmObject.NotifyRealmObjectPropertyChanged);
 }