On 14 Jan, 01:27, Vikram Nayak <
vikram.na...@gmail.com> wrote:
> Are there any best practices / scenarios when one API is better than
> the other?
Here's what I've learnt:
* Use CriteriaQueries when you are letting user build queries
dynamically. Actually you have other options now, with Linq to
NHibernate you can do this with Specification Design Pattern.
* Use named queries for best performance. They will be initialized by
NHibernate. You can use them for frequent querying. You will use
Hibernate Query Language for this.
* Use Linq to NHibernate if you prefer type-safe query code. You can
also use L2Nh to implement the Specification Design Pattern.
I'm not sure when to use QueryOver. I keep forgetting which means it
is not that interesting to me :-)
Good luck!
P.S. For more about Specifications you can see this post:
http://huyrua.wordpress.com/2010/08/25/specification-pattern-in-entity-framework-4-revisited/
Daniel