Thanks, updated my test project this morning and can now add items to the PersistentDictionary.
I have run into a new problem when iterating over the dictionary.
Exception - Newtonsoft.Json.JsonSerializationException, Could not create an instance of type System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[System.String,TestCouchbaseCollection.Foo]]. Type is an interface or abstract class and cannot be instantiated. Path 'Fred', line 1, position 8.
Thanks,
T
using (var cluster = await Cluster.ConnectAsync("couchbase://dev-docker01", "Administrator", "password"))
{
var bucket = await cluster.BucketAsync("sms-data").ConfigureAwait(false);
var collection = await bucket.DefaultCollectionAsync().ConfigureAwait(false);
var dict = collection.Dictionary<Foo>("testdatadict");
await dict.ClearAsync().ConfigureAwait(false);
await dict.AddAsync("Fred", new Foo { Name = "Tom", Age = 50 });
await dict.AddAsync("Bill", new Foo { Name = "Dick", Age = 30 });
foreach (var item in dict)
{
Console.WriteLine($"{item.Key} - {item.Value.Name}, {item.Value.Age}");
}
}
}