Last active
December 13, 2015 20:28
-
-
Save ronnieoverby/4969630 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| static void OtherInsertOverloadExample(BulkInserter<Person> bulkInserter, IEnumerable<Person> people) | |
| { | |
| // sql connection is being managed externally | |
| foreach (var person in people) | |
| { | |
| // contrived example... do some work on each person | |
| person.Salary = DetermineSalary(person); | |
| // this will add the object to a list managed by BulkInserter<T> | |
| // the data will not be written to the database until the list count == batch size | |
| bulkInserter.Insert(person); | |
| } | |
| // the list probably has some more | |
| // people that haven't been inserted | |
| // send remnant people to the database | |
| bulkInserter.Flush(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment