public class Foo : RealmObject
{
[MapTo("_id")]
[PrimaryKey]
[Required]
public string Id { get; set; }
[MapTo("bar")]
[Required]
public IDictionary<string, string> Bar { get; }
}
Here are some problems I collided with:
Partitional syncing can’t find any objects, realm.All<Foo>() returns a 0 length collection.
realm.WriteCopy() throws an exception: Incompatible property: class_Foo::bar
Flexible sync does not work at all. I could not manage to get it to work.
I also tried to use RealmDictionary<string> but the result was the same.
Sorry to hear things aren’t going great for you thus far. We are looking to surface some of these schema compatibility issues a bit better in the coming months. A few thoughts off the bat:
Your JSON Schema looks correct to me
Your Realm Model doesnt match up with your JSON Schema. I am surprised sync is even running for you. I suspect we rejecting the sync connection immediately. The reasons are that the Realm Scheme has _id as a required field but the JSON schema has it optional (missing the “required” tag). Also, we only support “non-required” dictionaries right now.
I’m not sure why your Partition Sync app is not returning any results. Can you confirm:
The collection in question has documents in it
The collection in question is the same DB/Collection in the schemas tab of the App Services UI
Why are you using WriteCopy()? That is a very specific method to generate state realms and I suspect you might not be trying to. You likely are just looking for Write()
Can you provide more details around what isnt working with Flexible Sync?
My best advice for you now would be to:
Terminate sync
Remove all schemas from the App Services UI
Enable sync and turn “dev mode on”
Connect the client to the app and it should automatically generate the JSON Schema given your Realm Object Models if they are valid.
If that doesn’t work, please let me know and perhaps provide your app_id (can be the URL in your App Services page) and I can try to look at what might be going wrong.
I made a document about all steps I did to show you my progress with this issue. I also made a more complicated schema to understand how to deal with embedded objects.