コード例 #1
0
        public static IDictionary <string, object?>?Map(DocumentSnapshot source, ServerTimestampBehavior?serverTimestampBehavior = null)
        {
            if (source != null && source.Exists)
            {
                NSDictionary <NSString, NSObject> data;
                if (serverTimestampBehavior == null)
                {
                    data = source.Data;
                }
                else
                {
                    data = source.GetData(serverTimestampBehavior.Value.ToNative()) !;
                }

                var instance  = new Dictionary <string, object?>();
                var fieldInfo = new DocumentFieldInfo <object>();

                foreach (var(key, value) in data)
                {
                    instance[key.ToString()] = value.ToFieldValue(fieldInfo);
                }

                return(instance);
            }
            return(null);
        }
コード例 #2
0
        public static IDictionary <string, object?>?Map(DocumentSnapshot source, ServerTimestampBehavior?serverTimestampBehavior = null)
        {
            if (source != null && source.Exists())
            {
                IDictionary <string, Java.Lang.Object> data;
                if (serverTimestampBehavior == null)
                {
                    data = source.Data;
                }
                else
                {
                    data = source.GetData(serverTimestampBehavior.Value.ToNative());
                }

                var fieldInfo = new DocumentFieldInfo <object?>();
                return(data.ToDictionary(pair => pair.Key, pair => pair.Value.ToFieldValue(fieldInfo)));
            }
            return(null);
        }