Created
July 10, 2020 12:34
-
-
Save mikependon/b0d922abb4bb8a1871db239bcaac55d7 to your computer and use it in GitHub Desktop.
RepoDb_Multiple_DataSources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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