Need help with Sync setup and partitions

Hello there, I’m a new user trying to migrate from MySQL to Realm, so far I’ve tested and it looks 100x better than MySQL to do queries and etc.

I’ve read the documentation and tutorials to set the sync for Xamarin but I’m having some trouble with partitions. Could someone explain me exactly what are partitions, how to use them and how to setup them inside the code?

Right now I have this on my server schema (I have no idea if this is the right place for the partition):

Now on my code side:
Doing the login and getting the user as said on the documentation:

User = await App.RealmApp.LogInAsync(Credentials.EmailPassword(UserBox.Text, PassBox.Text));

And then creating a SyncConfiguration with the user and the partition

SyncConfiguration = new SyncConfiguration("PUBLIC", User);
var realm = await Realm.GetInstanceAsync(SyncConfiguration);

But then it errors and gives me:
user does not have permission to sync on partition (ProtocolErrorCode=206)

@Technoo: For Realm Partition I would recommend you read this article, although this is for iOS platform but explains the concept very clearly.

Thanks alot Mohit! I’ve set up the partition and its permissions and it looks like I’m now able to connect to it!
The only thing is that writes aren’t saving properly, do you know why?

Oh my bad! Developer mode was off and it was trying to add a schema to Realm, sorry!

1 Like