public override void Commit()
 {
     _storage.UseTransaction(connection =>
     {
         foreach (Action <MySqlConnection> command in _commandQueue)
         {
             command(connection);
         }
     });
 }
コード例 #2
0
        public override void SetRangeInHash(string key, IEnumerable <KeyValuePair <string, string> > keyValuePairs)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (keyValuePairs == null)
            {
                throw new ArgumentNullException("keyValuePairs");
            }

            _storage.UseTransaction(connection =>
            {
                foreach (var keyValuePair in keyValuePairs)
                {
                    connection.Execute(
                        $"insert into {_options.TablePrefix}_Hash (`Key`, Field, Value) " +
                        "value (@key, @field, @value) " +
                        "on duplicate key update Value = @value",
                        new { key = key, field = keyValuePair.Key, value = keyValuePair.Value });
                }
            });
        }
コード例 #3
0
 private T UseConnection <T>(Func <MySqlConnection, T> action)
 {
     return(_storage.UseTransaction(action, IsolationLevel.ReadUncommitted));
 }