Exemplo n.º 1
0
        public static SessionHandle GetSession(string path, Native.SyncConfiguration configuration, byte[] encryptionKey)
        {
            DoInitialFileSystemConfiguration();

            var result = NativeMethods.get_session(path, (IntPtr)path.Length, configuration, encryptionKey, out var nativeException);

            nativeException.ThrowIfNecessary();

            return(new SessionHandle(result));
        }
        public static SharedRealmHandle OpenWithSync(Configuration configuration, Sync.Native.SyncConfiguration syncConfiguration, RealmSchema schema, byte[] encryptionKey)
        {
            var marshaledSchema = new SchemaMarshaler(schema);

            var result = NativeMethods.open_with_sync(configuration, syncConfiguration, marshaledSchema.Objects, marshaledSchema.Objects.Length, marshaledSchema.Properties, encryptionKey, out var nativeException);

            nativeException.ThrowIfNecessary();

            return(new SharedRealmHandle(result));
        }
        public static SharedRealmHandle OpenWithSync(Configuration configuration, Native.SyncConfiguration syncConfiguration, RealmSchema schema, byte[] encryptionKey)
        {
            DoInitialFileSystemConfiguration();

            var marshaledSchema = new SharedRealmHandle.SchemaMarshaler(schema);

            NativeException nativeException;
            var             result = NativeMethods.open_with_sync(configuration, syncConfiguration, marshaledSchema.Objects, marshaledSchema.Objects.Length, marshaledSchema.Properties, encryptionKey, out nativeException);

            nativeException.ThrowIfNecessary();

            var handle = new SharedRealmHandle();

            handle.SetHandle(result);
            return(handle);
        }
Exemplo n.º 4
0
        internal override Realm CreateRealm(RealmSchema schema)
        {
            var configuration = new Realms.Native.Configuration
            {
                schema_version = SchemaVersion
            };

            var syncConfiguration = new Native.SyncConfiguration
            {
                SyncUserHandle = User.Handle,
                Url            = ServerUri.ToString()
            };

            var srHandle = SharedRealmHandleExtensions.OpenWithSync(configuration, syncConfiguration, schema, EncryptionKey);

            return(new Realm(srHandle, this, schema));
        }
Exemplo n.º 5
0
        internal override Realm CreateRealm(RealmSchema schema)
        {
            var configuration = new Realms.Native.Configuration
            {
                Path = DatabasePath,
                schema_version = SchemaVersion
            };

            var syncConfiguration = new Native.SyncConfiguration
            {
                SyncUserHandle = User.Handle,
                Url = ServerUri.ToString()
            };

            var srHandle = SharedRealmHandleExtensions.OpenWithSync(configuration, syncConfiguration, schema, EncryptionKey);
            return new Realm(srHandle, this, schema);
        }
Exemplo n.º 6
0
        internal override Realm CreateRealm(RealmSchema schema)
        {
            var configuration = new Realms.Native.Configuration
            {
                Path           = DatabasePath,
                schema_version = SchemaVersion
            };

            var syncConfiguration = new Native.SyncConfiguration
            {
                SyncUserHandle      = User.Handle,
                Url                 = ServerUri.ToString(),
                client_validate_ssl = EnableSSLValidation,
            };

            var srHandle = SharedRealmHandleExtensions.OpenWithSync(configuration, syncConfiguration, schema, EncryptionKey);

            return(new Realm(srHandle, this, schema));
        }
 public static extern IntPtr get_session([MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr path_len, Native.SyncConfiguration configuration, byte[] encryptionKey, out NativeException ex);
 public static extern IntPtr open_with_sync(Configuration configuration, Native.SyncConfiguration sync_configuration,
                                            [MarshalAs(UnmanagedType.LPArray), In] SchemaObject[] objects, int objects_length,
                                            [MarshalAs(UnmanagedType.LPArray), In] SchemaProperty[] properties,
                                            byte[] encryptionKey,
                                            out NativeException ex);
        public static AsyncOpenTaskHandle OpenWithSyncAsync(Configuration configuration, Sync.Native.SyncConfiguration syncConfiguration, RealmSchema schema, byte[] encryptionKey, GCHandle tcsHandle)
        {
            var marshaledSchema = new SchemaMarshaler(schema);

            var asyncTaskPtr = NativeMethods.open_with_sync_async(configuration, syncConfiguration, marshaledSchema.Objects, marshaledSchema.Objects.Length, marshaledSchema.Properties, encryptionKey, GCHandle.ToIntPtr(tcsHandle), out var nativeException);

            nativeException.ThrowIfNecessary();
            var asyncTaskHandle = new AsyncOpenTaskHandle(asyncTaskPtr);

            return(asyncTaskHandle);
        }