public override void Commit() { _storage.UseTransaction(connection => { foreach (Action <MySqlConnection> command in _commandQueue) { command(connection); } }); }
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 }); } }); }
private T UseConnection <T>(Func <MySqlConnection, T> action) { return(_storage.UseTransaction(action, IsolationLevel.ReadUncommitted)); }