I have an IEnumerable and I would like to do a batch insert (240,000+ records). I've been perusing the forums and SO and I haven't been able to come up with something that works...
The other catch is that I need to be able to specify a different provider, as these records need to be inserted into a database with a different connection string.
Basically, something like this:
IEnumerable<MyObject> records = GetRecords();
SubSonicDooHickey.BatchSave(records, "differentSubsonicProvider")
I know that isn't exact, but something along those lines...
I've tried:
var itemsToSaveCollection = new ItemCollection(); // Your collection type here
foreach (var xmlItem in xmlItems)
{
var item = new Item(); // Your data model type here
// Set item values from xml
itemsToSaveCollection.Add(item);
}
itemsToSaveCollection.BatchSave();
(and several others) but couldn't get them to work...the above code didn't work because I couldn't find an appropriate collection from subsonic that had a .BatchSave
function on it, and I also wouldn't know how to change the provider.