Skip to content

Instantly share code, notes, and snippets.

@mikependon
Created July 10, 2020 12:34
Show Gist options
  • Save mikependon/b0d922abb4bb8a1871db239bcaac55d7 to your computer and use it in GitHub Desktop.
Save mikependon/b0d922abb4bb8a1871db239bcaac55d7 to your computer and use it in GitHub Desktop.
RepoDb_Multiple_DataSources.cs
// SqlConnection
using (var connection = new SqlConnection(connectionStringToSqlServer))
{
var customers = connection.QueryAll<Customer>();
}
// PostgreSQL
using (var connection = new NpgqlConnection(connectionStringToPostgreSQL))
{
var sales = connection.QueryAll<Sale>();
var orders = connection.QueryAll<Order>();
}
// SqlConnection
using (var connection = new MySqlConnection(connectionStringToMySQL))
{
var products = connection.QueryAll<Product>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment