Hi @Bruno_Zimmermann unfortunately there is no automated way to do what you are trying to do with flexible sync, and your best option would be to do the conversion yourself, moving objects from one realm to another.
That said, we have opened an issue on Github (Add support for realm sync disconnected configuration type · Issue #3110 · realm/realm-dotnet · GitHub) that you can follow and that could help in your case when implemented. The main idea there is to provide a configuration (“disconnected”) that allows to open synced realm without synchronisation.
In that case your flow would be:
- Open the sync realm the first time with the flexible sync configuration, and let the user log in, then close it.
- Open the realm with the new “disconnected” config and let the user work offline
- When the use registers you can open it again with the flexible sync configuration.
- If needed, you can go back to using the “disconnected” config.
There are two issues with this approach though:
- This is not yet implemented
- Having a synced realm offline for a long time means that the realm file could greatly grow in size. An offline synced realm is still writing down the “history” of everything that is happening to the objects (so that it can be synced up when online again). This history could become quite big if the user doesn’t go online soon.
For those reason I still think that doing it manually is still the best option in your case.