public abstract class CouchRepositoryBase<T> : CouchRepositoryBase where T : ICouchEntity
{
// omitted some codes
public bool Add(T entity)
{
return Add(entity, DateTime.Now);
}
}
If you’re trying to simply store the list as a single document, then you can just store that directly with Insert or Upsert. It will be serialized as a JSON array with syntax like [{…}, {…}].
However, it looks like you are doing a change tracking system, building a list of documents with Add and then you’ll have another Save method called later to write them all? If that’s the case, I’d recommend inserting them in parallel using a bunch of InsertAsync or UpsertAsync calls. If you have a very large number of documents, I’d recommend making sure you don’t start up more than a few dozen at a time.
You can use the code for multi-get as an example, and make a multi-insert implementation. Unfortunately the SDK doesn’t currently have a multi-insert method built in. Here’s a link to the multi-get code: