public void Insert <T>(string connection, T obj) where T : class { using (var c = new MySqlData.MySqlConnection(connection)) { _log.LogTrace <MySqlQuery>($"INSERT: {nameof(obj)}. Connection: {connection}. Object: {JsonConvert.SerializeObject(obj)}"); c.Open(); c.Insert(obj); c.Close(); } }
public async Task InsertAsync <T>(T obj) where T : class { await Task.Run(() => { using (var connection = new MySqlData.MySqlConnection(_connection)) { connection.Open(); connection.Insert(obj); connection.Close(); } }); }
public async Task InsertAsync <T>(string connection, T obj) where T : class { await Task.Run(() => { using (var c = new MySqlData.MySqlConnection(connection)) { c.Open(); c.Insert(obj); c.Close(); } }); }