示例#1
0
        protected bool Set <TObject>(string uniqueKey, TObject @object)
            where TObject : class
        {
            if (string.IsNullOrWhiteSpace(uniqueKey) ||
                uniqueKey.Length > UniqueKeyMaxLength)
            {
                return(false);
            }

            var value = new Value
            {
                JsonValue = JsonConvert.SerializeObject(@object)
            };

            bool result = _values.Set(value);

            if (result)
            {
                result = _keyIdPairs.Set(uniqueKey, value.Id);
            }

            return(result);
        }
示例#2
0
 public void Execute(SetValueCommandContext commandContext)
 {
     _repository.Set(commandContext.Key, commandContext.Value);
 }