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