Last active
May 30, 2019 13:12
-
-
Save mikependon/e45ee277217c4b485e32eba4ca0c8777 to your computer and use it in GitHub Desktop.
IDbConnection (InsertAll<Orders>)
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
// Create a list | |
var orders = new List<Order>(); | |
// Add each item | |
orders.Add(new Order { CustomerId = 10045, Quantity = 1, ProductId = 24 }); | |
orders.Add(new Order { CustomerId = 10045, Quantity = 4, ProductId = 27 }); | |
// More orders here | |
// Call the InsertAll | |
using (var connection = new SqlConnection(connectionString)) | |
{ | |
connection.InsertAll<Order>(orders); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment