I do some tests with nhibernate and I modify batch_size to get voluminous inserts.
I am using mssql2005 and using db Northwind. I created 1000 objects and inserted them into the database. I changed the batch_size values ββfrom 5 to 100, but did not find any performance changes. I get a value of about 300 ms. Using the sql profiler, I see that 1000 sql-paste statements are server-side. Please, help.
app.config
<property name="adonet.batch_size">10</property>
the code
public bool MyTestAddition(IList<Supplier> SupplierList) { var SupplierList_ = SupplierList; var stopwatch = new Stopwatch(); stopwatch.Start(); using (ISession session = dataManager.OpenSession()) { int counter = 0; using (ITransaction transaction = session.BeginTransaction()) { foreach (var supplier in SupplierList_) { session.Save(supplier); } transaction.Commit(); } } stopwatch.Stop(); Console.WriteLine(string.Format("{0} milliseconds. {1} items added", stopwatch.ElapsedMilliseconds, SupplierList_.Count)); return true; }
nhibernate
gajah
source share