NHibernate HiLO: different needs in different application scopes

I run a set of applications (2 web applications, 1 windows service) that share the same database, and same DAO layer based on NHibernate.

The service is responsible for running jobs, that can potentially insert 1000's of lines in the database.

In both web applications, the session lifecycle is per request, and in the windows service it's per job.

Here is the question:

  • in web applications, the session can at most, during its life, insert 1 element in the database
  • in the service, the session can insert 1000's of lines during its life
  • If I set a HiLO value of 1000 in my mappings, in order to optimize batch insert in the service, ID's are going to be wasted by web apps (who will never insert more that 1 item, wasting 999 IDs).

    Is it a good practice to waste so many IDs? Is there any possibility to optimize this?

    链接地址: http://www.djcxy.com/p/19128.html

    上一篇: 在Vim中有没有将文本放入寄存器的方法?

    下一篇: NHibernate HiLO:不同应用程序范围中的不同需求