I am using SaveEntityCollection to save over 3000 record, but it takes 4 minutes to save, is there a more optimal way of saving in bulk?
public string SaveEntityCollection(EntityCollection<MEntity> obj)
{
string retval = null; // null indicates success; if this is not null at the end, it will hold the error message
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
try
{
adapter.StartTransaction(IsolationLevel.ReadCommitted, "SaveMEntity");
//now save the new object
adapter.SaveEntityCollection(obj,false,false);
adapter.Commit();
}
catch (ORMQueryExecutionException e)
{
if (adapter.IsTransactionInProgress)
{
adapter.Rollback();
}
}
catch (Exception ex)
{
if (adapter.IsTransactionInProgress)
{
adapter.Rollback();
}
retval = $"General error: {ex.Message}";
}
} // the adapter gets automatically disposed here because of the 'using' statement
return retval; // will be null if everything went fine, or an error message otherwise
}