3

i just started discovering serviceStack ORMlite , and i am trying to figure out how to do batch inserts. Are there any example of this anywhere ?

Thanks in advance

mythz
  • 141,670
  • 29
  • 246
  • 390
alainb
  • 185
  • 1
  • 6

1 Answers1

5

There's currently no built-in support take take advantage of custom RDBMS's support for this feature. E.g. MySQL's Batch Insert support.

The Insert and InsertAll methods in OrmLite do already accept multiple entities, but they're executed individually.

Depending on the database (that support batch insert via SQL) you can execute custom arbitrary SQL by using IDbCommand.ExecuteSql method.

Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390
  • 1
    Thank you for your answer , i am testing ORMLite with SQLite currently , and after some tests , i see that using transactions allows huge improvments. And as you said , using direct SQL can always be done. Thats a very good Data Framework :-) – alainb Jul 30 '12 at 17:30