Esempio n. 1
0
        private static Task <DocumentWrapper <T> > PlatformCreateAsync <T>(string documentId, T document, string partition, WriteOptions writeOptions)
        {
            var taskCompletionSource = new TaskCompletionSource <DocumentWrapper <T> >();
            var msWriteOptions       = writeOptions.ToMSWriteOptions();

            MSData.Create(documentId, document.ToMSDocument(), partition, msWriteOptions, resultDoc =>
            {
                ProcessResult(resultDoc, taskCompletionSource);
            });
            return(taskCompletionSource.Task);
        }
Esempio n. 2
0
        private static Task <DocumentWrapper <T> > PlatformCreateAsync <T>(string documentId, T document, string partition, WriteOptions writeOptions)
        {
            var taskCompletionSource = new TaskCompletionSource <DocumentWrapper <T> >();
            var msWriteOptions       = writeOptions.ToMSWriteOptions();

            try
            {
                var msDictionaryDocument = document.ToMSDocument();
                MSData.Create(documentId, msDictionaryDocument, partition, msWriteOptions, resultDoc =>
                {
                    ProcessResult(resultDoc, taskCompletionSource);
                });
            }
            catch (NSErrorException e)
            {
                taskCompletionSource.SetException(e);
            }
            return(taskCompletionSource.Task);
        }