sql server - C# Nhibernate Save List -


today had list 40.000 registers needed save in mssql db. when tried save it, checked console display , realized saving item item, , consumed lot of time, me trying insert entire list comand below.

list<andamento> andamentolist = fillandamentolist(parameters); _repository.save(andamentolist); _repository.commit(); 

is possible configure nhibernate , change insert entire list 1 database interaction?

thank much,

for batching using nhibernate need use stateless session:

using (var statelesssession = sessionfactory.openstatelesssession()) using (var transaction = statelesssession.begintransaction()) {     foreach (var item in andamentolist)     {         statelesssession.insert(item);     }      transaction.commit(); } 

combine batch size gain performance in config file:

<property name="adonet.batch_size">100</property> 

you can read more here.


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -