internal CustomerDTO GetCustomerById(string customerId) { string query = string.Format( @"SELECT * FROM Customer INNER JOIN Address USING(address_id) WHERE customer_id = '{0}'", customerId); var dataSource = DataSource; dataSource.Open(); var queryResult = QueryDataSource(query, dataSource); if (!queryResult.Read()) { throw new NotFoundException("Cannot find customer with Id " + customerId); } var dto = _adapter.ToCustomerDTO(queryResult); dataSource.Close(); return(dto); }