public Order GetOrder(int id) { using (MySql.Data.MySqlClient.MySqlConnection connection = new MySql.Data.MySqlClient.MySqlConnection(connectionStr)) { try { connection.Open(); var order = connection.QueryFirstOrDefault <Order>("Select * from oms_order where id=@Id", new { Id = id }); return(order); } finally { connection.Close(); } } }