Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mikependon/bdc8520b8ecb1362a61d40386fd9bfc9 to your computer and use it in GitHub Desktop.
Save mikependon/bdc8520b8ecb1362a61d40386fd9bfc9 to your computer and use it in GitHub Desktop.
RepoDb_ExecuteQuery_BulkInsert_Combination
// Source from PostgreSQL
using (var sourceConnection = new NpgqlConnection(connectionStringToPostgreSQL))
{
var sales = sourceConnection.QueryAll<Sale>(e => e.OrderDate >= 'FromDate' && e.OrderDate <= 'ToDate');
// Destination to SQL Server
using (var destinationConnection = new SqlConnection(connectionStringToSqlServer))
{
destinationConnection.BulkInsert<Sale>(sales);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment