I need to save thousand of records in a database. I am using CastleProject ActiveRecord. The cycle which stores that amount of objects works too long.
Is it possible to run saving in a batch using ActiveRecord? What is recommended way to improve performance?
It seems I found the solution. There are two main steps:
using (TransactionScope scope = new TransactionScope())
{
for (int i = 0; i < 100; i++)
{
Contact contact = new Contact();
contact.Save();
}
}