public long Insert(Model.Model model) { var cmd = new MySqlCommand { Connection = _getConnection() }; var attributes = model.GetAttributes(); cmd.CommandText = "INSERT INTO " + model.TableName() + " VALUES(@" + string.Join(",@", attributes.Keys) + ")"; cmd.Prepare(); foreach (var(key, value) in attributes) { cmd.Parameters.AddWithValue("@" + key, value); } cmd.ExecuteNonQuery(); model.GetPrimaryColumnProperty().SetValue(model, cmd.LastInsertedId); return(cmd.LastInsertedId); }