Skip to content

File tree

9 files changed

+49
-89
lines changed

9 files changed

+49
-89
lines changed

config/redirects

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ raw: ${prefix}/sdk/dotnet/fundamentals/device-sync -> ${base}/sdk/dotnet/sync/
10201020
raw: ${prefix}/sdk/dotnet/fundamentals/asymmetric-sync -> ${base}/sdk/dotnet/sync/asymmetric-sync/
10211021
raw: ${prefix}/sdk/dotnet/advanced-guides/client-reset -> ${base}/sdk/dotnet/sync/client-reset/
10221022
raw: ${prefix}/sdk/dotnet/examples/open-a-realm -> ${base}/sdk/dotnet/sync/configure-and-open-a-synced-realm/
1023-
raw: ${prefix}/sdk/dotnet/advanced-guides/convert-realm -> ${base}/sdk/dotnet/sync/convert-realm/
1023+
raw: ${prefix}/sdk/dotnet/advanced-guides/convert-realm -> ${base}/sdk/dotnet/sync/configure-and-open-a-synced-realm
10241024
raw: ${prefix}/sdk/dotnet/examples/flexible-sync -> ${base}/sdk/dotnet/sync/flexible-sync/
10251025
raw: ${prefix}/sdk/dotnet/examples/work-with-users -> ${base}/sdk/dotnet/work-with-users/
10261026
raw: ${prefix}/sdk/dotnet/advanced-guides -> ${base}/sdk/dotnet/
@@ -1292,10 +1292,15 @@ raw: ${prefix}/sdk/node/integrations/electron-cra -> ${base}/sdk/node/
12921292
raw: ${prefix}/sdk/node/integrations/electron -> ${base}/sdk/node/
12931293
raw: ${prefix}/sdk/node/integrations -> ${base}/sdk/node/
12941294

1295-
# DOP-4255 Rehoming /docs/realm docs at /docs/atlas/device-sdks
1295+
# DOP-4452 Rehoming /docs/realm docs at /docs/atlas/device-sdks
12961296
raw: ${prefix} -> ${deviceSDKsBase}/
12971297
raw: ${prefix}/introduction -> ${deviceSDKsBase}/introduction/
12981298
raw: ${prefix}/realm-query-language -> ${deviceSDKsBase}/realm-query-language/
12991299
raw: ${prefix}/example-projects -> ${deviceSDKsBase}/example-projects/
13001300
raw: ${prefix}/help -> ${deviceSDKsBase}/help/
1301-
raw: ${prefix}/migrate -> ${deviceSDKsBase}/migrate/
1301+
raw: ${prefix}/migrate -> ${deviceSDKsBase}/migrate/
1302+
1303+
# DOCSP-39075
1304+
# No clarity from DOP on whether to use ${deviceSDKsBase} or ${base}, so going
1305+
# with what we know works (${base}).
1306+
raw: ${prefix}/sdk/dotnet/sync/convert-realm -> ${base}/sdk/dotnet/sync/configure-and-open-a-synced-realm

examples/dotnet/Examples/Convert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public async Task TestNoSyncToSync()
2020
var app = App.Create("my-app-id");
2121
var user = await app.LogInAsync(
2222
Credentials.EmailPassword("[email protected]", "password"));
23-
var syncConfig = new FlexibleSyncConfiguration(user);
23+
var syncConfig = new PartitionSyncConfiguration("user_partition", user);
2424

2525
existingRealm.WriteCopy(syncConfig);
2626

source/examples/generated/dotnet/Convert.snippet.nonsync-to-sync.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
var app = App.Create("my-app-id");
55
var user = await app.LogInAsync(
66
Credentials.EmailPassword("[email protected]", "password"));
7-
var syncConfig = new FlexibleSyncConfiguration(user);
7+
var syncConfig = new PartitionSyncConfiguration("user_partition", user);
88

99
existingRealm.WriteCopy(syncConfig);
1010

source/sdk/dotnet/sync.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Sync Data Between Devices - .NET SDK
1616
Client Resets </sdk/dotnet/sync/client-reset>
1717
Suspend or Resume a Sync Session </sdk/dotnet/sync/sync-session>
1818
Check Upload & Download Progress </sdk/dotnet/sync/sync-progress>
19-
Convert Between Non-Synced Realms and Synced Realms </sdk/dotnet/sync/convert-realm>
2019
Stream Data to Atlas </sdk/dotnet/sync/asymmetric-sync>
2120
Partition-Based Sync </sdk/dotnet/sync/partition-based-sync>
2221

source/sdk/dotnet/sync/configure-and-open-a-synced-realm.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@ and vice versa, but you cannot sync a non-synced realm.
4848
.. _convert-realm-sync:
4949

5050
Convert Between Synced and Non-Synced Realms
51-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52-
53-
Realm does not have a direct mechanism to add sync to a non-synced realm,
54-
or to permanently stop Sync for a synced realm. However, the .NET SDK does
55-
provide methods that enable you to copy a realm file for use with a different
56-
configuration. With these methods, you can easily duplicate a realm's data,
57-
which you can then open with a sync or non-sync configuration. This lets
58-
you indirectly add Sync to a non-synced realm, or permanently stop a realm
59-
from syncing. For more information, refer to :ref:`<dotnet-convert-to-sync>`.
60-
51+
````````````````````````````````````````````
52+
To convert a non-synced realm to a synced realm, you can follow the process
53+
described in :ref:`Migrate a Local-Only App to a Sync-Enabled App <realm-sync-local-to-sync>`.
54+
The .NET SDK also provides the
55+
:dotnet-sdk:`WriteCopy() <reference/Realms.Realm.html#Realms_Realm_WriteCopy_Realms_RealmConfigurationBase_>`
56+
method, which enables you to duplicate a non-synced realm's data to a sync realm.
57+
For more information, refer to :ref:`<dotnet-convert-to-sync>`.
58+
59+
.. include:: /includes/note-writecopy-local-to-sync.rst
6160

6261
Synced Realms
6362
~~~~~~~~~~~~~

source/sdk/dotnet/sync/convert-realm.txt

Lines changed: 0 additions & 70 deletions
This file was deleted.

source/sdk/dotnet/sync/partition-based-sync.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ method:
7373

7474
:ref:`Partition Strategies <partition-strategies>`
7575

76-
7776
Open a Partition-Based Sync Realm While Offline
7877
-----------------------------------------------
7978

@@ -163,3 +162,27 @@ codebase for future iteration and debugging.
163162

164163
For more information about the automatically-generated Flexible Sync
165164
subscriptions, refer to :ref:`realm-sync-migrate-client`.
165+
166+
.. _dotnet-convert-to-sync:
167+
168+
Migrate from Non-Synced Realms to Synced Realms
169+
-----------------------------------------------
170+
You can convert a non-synced realm to a synced realm (with partition-based sync).
171+
To convert from a non-synced realm to one that uses partition-based sync, you do
172+
the following:
173+
174+
1. Open the existing realm.
175+
2. Create a configuration for a new realm.
176+
3. Call the :dotnet-sdk:`WriteCopy() <reference/Realms.Realm.html#Realms_Realm_WriteCopy_Realms_RealmConfigurationBase_>`
177+
method on the existing realm to copy the data to the new realm.
178+
179+
In the following code, we open a non-synced realm, create a new
180+
:dotnet-sdk:`PartitionSyncConfiguration <reference/Realms.Sync.PartitionSyncConfiguration.html>`
181+
object and then copy the existing realm to the new realm. We then delete the
182+
existing realm and open the new realm.
183+
184+
.. literalinclude:: /examples/generated/dotnet/Convert.snippet.nonsync-to-sync.cs
185+
:language: csharp
186+
:copyable: true
187+
188+
.. include:: /includes/note-writecopy-local-to-sync.rst

source/sdk/flutter/sync.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ Synced realms differ from non-synced local Realm in a couple of ways:
6464
realms have no concept of users or authentication.
6565

6666
You can copy data from a non-synced realm to a synced realm,
67-
and vice versa, but you cannot sync a non-synced realm.
67+
and vice versa, but you cannot sync a non-synced realm. To convert a non-synced
68+
realm to a synced realm, you can follow the process
69+
described in :ref:`Migrate a Local-Only App to a Sync-Enabled App <realm-sync-local-to-sync>`.
6870

6971
.. _flutter-flexible-sync-fundamentals:
7072

source/sdk/swift/sync/configure-and-open-a-synced-realm.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ few ways:
6060
be used offline.
6161

6262
You can copy data from a non-synced realm to a synced realm,
63-
and vice versa, but you cannot sync a non-synced realm.
63+
and vice versa, but you cannot sync a non-synced realm. To convert a
64+
non-synced realm to a synced realm, you can follow the process
65+
described in :ref:`Migrate a Local-Only App to a Sync-Enabled App <realm-sync-local-to-sync>`.
6466

6567
For more information about how to configure and open a non-synced realm,
6668
refer to: :ref:`ios-configure-and-open-a-realm`.

0 commit comments

Comments
 (0)