I read Ayende post about Futures in NHibernate and started using it. At first only for i开发者_StackOverflow社区solated scenario - queries that return paged results (to both query and count items in single trip to database). But than I thought why not to use futures for every single query. In most of my action methods I need to make multiple queries, on average 5 per page (to get user profile, footer, categories, group information etc).
Obvious benefit is that overall this queries summed up should take shorter to run. But are there any drawbacks for such design of web application? Areas that make me curious are:
- Caching in NHibernate - will this design prevent in any way of using caching features of NHibernate?
- Maybe such single pack of queries will lock database tables and make other parallel actions wait? I use Read Committed isolation level.
Any other? What are your experiences with futures? Would you recommend using it in such a way, to every possible item?
Your concerns won't apply. Caching won't be broken and its pretty rare to lock tables just batching up read statements.
Futures rock and I wish every ORM I use had them.
精彩评论