Beispiel #1
0
        private void SetObject([NotNull] string key, object value)
        {
            CBDebug.MustNotBeNull(WriteLog.To.Database, Tag, nameof(key), key);

            value = DataOps.ToCouchbaseObject(value);
            var oldValue = _dict.Get(key);

            if (!_dict.ContainsKey(key) || (value != oldValue && value?.Equals(oldValue) != true))
            {
                _dict[key] = value;
                HasChanges = true;
            }
        }
Beispiel #2
0
        public object GetValue(string key)
        {
            CBDebug.MustNotBeNull(WriteLog.To.Database, Tag, nameof(key), key);

            if (!_dict.TryGetValue(key, out var obj))
            {
                return(null);
            }

            var cblObj = DataOps.ToCouchbaseObject(obj);

            if (cblObj != obj && cblObj?.GetType() != obj.GetType())
            {
                _dict[key] = cblObj;
            }

            return(cblObj);
        }
Beispiel #3
0
 public IMutableDictionary SetData(IDictionary <string, object> dictionary)
 {
     _dict      = dictionary.ToDictionary(x => x.Key, x => DataOps.ToCouchbaseObject(x.Value));
     HasChanges = true;
     return(this);
 }
Beispiel #4
0
 public Dictionary <string, object> ToDictionary()
 {
     return(_dict.ToDictionary(x => x.Key, x => DataOps.ToNetObject(x.Value)));
 }
Beispiel #5
0
 public int GetInt(string key)
 {
     return(DataOps.ConvertToInt(GetValue(key)));
 }
Beispiel #6
0
 public long GetLong(string key)
 {
     return(DataOps.ConvertToLong(GetValue(key)));
 }
Beispiel #7
0
 public float GetFloat(string key)
 {
     return(DataOps.ConvertToFloat(GetValue(key)));
 }
Beispiel #8
0
 public double GetDouble(string key)
 {
     return(DataOps.ConvertToDouble(GetValue(key)));
 }
Beispiel #9
0
 public DateTimeOffset GetDate(string key)
 {
     return(DataOps.ConvertToDate(GetValue(key)));
 }
Beispiel #10
0
 public bool GetBoolean(string key)
 {
     return(DataOps.ConvertToBoolean(GetValue(key)));
 }
Beispiel #11
0
 public IMutableDictionary SetJSON([NotNull] string json)
 {
     return(SetData(DataOps.ParseTo <Dictionary <string, object> >(json)));
 }