Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save westdavidr/a273d0391935ef7e63af0ed3e2f9cd57 to your computer and use it in GitHub Desktop.
Save westdavidr/a273d0391935ef7e63af0ed3e2f9cd57 to your computer and use it in GitHub Desktop.

Fetch customer asynchronously

public async Task<Customer> GetCustomerById(long id)
{
  var cmd = Sequelocity.GetDatabaseCommand();
  cmd.SetCommandText(@"select top 1 * from dbo.Customer where CustomerId = @CustomerId");
  cmd.AddParameter("@CustomerId", id, DbType.Int64);
  
  return await cmd.ExecuteToObjectAsync<Customer>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment