public async Task SetDataAsync(Dictionary <object, object> data, SetOptions options = null)
 {
     if (options == null)
     {
         await Wrapped.Set(data.ToHashMap());
     }
     else
     {
         await Wrapped.Set(data.ToHashMap(), options.ToNative());
     }
 }
Ejemplo n.º 2
0
        public static NativeSetOptions ToNative(this SetOptions options)
        {
            switch (options.Type)
            {
            case SetOptions.TypeMerge:
                return(NativeSetOptions.Merge());

            case SetOptions.TypeMergeFieldPaths:
                return(NativeSetOptions.MergeFieldPaths(options.FieldPaths.Select(x => NativeFieldPath.Of(x.ToArray())).ToList()));

            case SetOptions.TypeMergeFields:
                return(NativeSetOptions.MergeFields(options.Fields));

            default:
                throw new ArgumentException($"SetOptions type {options.Type} is not supported.");
            }
        }
 public IWriteBatch SetData(IDocumentReference document, Dictionary <object, object> data, SetOptions options = null)
 {
     return(options == null
         ? _wrapped.Set(document.ToNative(), data.ToHashMap()).ToAbstract()
         : _wrapped.Set(document.ToNative(), data.ToHashMap(), options.ToNative()).ToAbstract());
 }
 public ITransaction SetData(IDocumentReference document, object data, SetOptions options = null)
 {
     return(options == null
         ? _wrapped.Set(document.ToNative(), data.ToHashMap()).ToAbstract()
         : _wrapped.Set(document.ToNative(), data.ToHashMap(), options.ToNative()).ToAbstract());
 }