LINQ and QueryOver are completely different query methods, which are added to the ones that existed in NHibernate 2 (Criteria, HQL, SQL)
QueryOver is meant as a strongly-typed version of Criteria, and supports mostly the same constructs, which are NHibernate-specific.
LINQ is a "standard" query method, which means the client code can work on IQueryable without explicit references to NHibernate. It supports a different set of constructs; it would be hard to say if there are more or less than with QueryOver.
My suggestion is to learn all the supported query methods, as each use case is different and some work better with one, some work better with other.
I started to use NH-Linq, because i was already done with LinqToSql and Entity Framework. But, for more complex queries, i have always finished with QueryOver. Reasons:
- It's happen that query with NH-Linq doesn't work as expected. I can't remember exactly, but it doesn't work correct with some complex queries. Seems that is too young. And as dlang stated in previous answer, it's produce unefficient SQL.
- When you learn QueryOver, it's easy to call functions, do projections, subqueries, seems to me more easy then with NH-Linq.
- Good thing for NH-Linq - it can be extended, like Fabio Maulo explained here. But, similar is quite possible with QueryOver, but not so fancy as with NH-Linq :)
LINQ to NHibernate (as of version 3.0) does not support the .HasValue property on Nullable types. One must compare to null in queries.
I have used both NH-Linq-providers (the old NHContrib for Version 2.1, and also the new for NH3.0) and also used QueryOver. With all the experience made during development of quite complex data-driven applications, I would strongly suggest NOT to use the existing linq-provider with nHibernate if you plan to go behind just basic CRUD-operations!
The current implementation (linq) sometimes produces really unreadable and also unefficient SQL. Especially joining some tables quickly becomes a nightmare if you want to optimize database-performance.
Despite all these drawbacks, I did never encounter wrong queries. So if you don't care about performance and are already familiar with LINQ, then go for NH-Linq. Otherwise QueryOver is your realiable and typesafe friend.
- Tradeoffs using NHibernate 3.0 QueryOver or LINQ provider
- Using nHibernate is it possible to mix a QueryOver result with a linq query?
- Convert string to int in one line of code using LINQ
- Fetch vs FetchMany in NHibernate Linq provider
- NHibernate Second Level Cache With NHibernate Linq Provider 1.0
- NHibernate efficient Delete using LINQ Where condition
- NHibernate Linq provider and take() skip() with eager fetching
- Best open source LINQ provider
- Using LINQ with NHibernate
- Left outer join using LINQ -- understanding the code
- How to reuse a linq expression for 'Where' when using multiple source tables
- Avoiding code repetition when using LINQ
- Using LINQ to delete an element from a ObservableCollection Source
- How to set Nhibernate LINQ Command Timeout using Session.Query
- LINQ Source Code Available
- Transform LINQ IQueryable into a paged IQueryable using LINQ to NHibernate
- NHibernate linq provider datediff
- NHibernate querying on a string collection using Linq results in either error or empty collection
- using a calculated property (not mapped) in Nhibernate QueryOver
- Where with IN operator using Linq on NHibernate
- How can I write the following code more elegantly using LINQ query syntax?
- How can I code an outer join using LINQ and EF6?
- NHibernate 3 - extending Linq provider BaseHqlGeneratorForMethod.BuildHql problem
- C# .Net 3.5 Code to replace a file extension using LINQ
- how to concat two column with hibernate queryover using linq
- Trying to understand LINQ code using c#
- Retrieve bool result by using LinQ code
- creating Linq to sqlite dbml from DbLinq source code
- read icollection data using LINQ in C# code
- Custom Linq generator (AddDays) using NHibernate
More Query from same tag
- Linq statement only executing once and returning zero on second try and above in foreach loop
- Does number of select columns affects efficiency in linq query?
- Set up self referencing class
- Can I do a "Take(x)" on the "Include" entity in a Linq Query?
- Linq - NHibernate - get all classes where the dictionary property contains one of the items from my list
- Converting an SQL with Left Join , Group and Sum to a Linq Query
- Linq causes syntax error with Top (1)
- LINQ to SQL DBML: Drag and Drop changing table names
- how to `.Take()` on a string and get a string at the end?
- Avoid to browse a list multiple time with linq, with dynamic conditions (filter)
- Is LINQ to XML order dependent and can you number results with it?
- Will Dispose be called first and cause a failure in case of deferred execution?
- Unknown column 'Project1.ID' in 'where clause'
- Weird Entity Framework error: login failed for user
- Conditional clauses for linq to Db4O query?
- C# how to filter a list by different properties at runtime
- c#: how to set combobox valuemember from linq query
- GroupBy with linq method syntax (not query syntax)
- Return list of string
- Group and separate list
- How to write this C# statement in linq
- How to get how many rows that has a column with the same record
- Using LINQ SequenceEqual extension method with occassionally null properties
- C# Linq compare only date from a datetime property
- net core Linq dynamic Sort
- Prevent Duplicates From Being Saved In Database
- Subsonic 3.0 and linq
- How can I do a "one hit" Linq query with nullable values?
- linq groupby Months and add any missing months to the grouped data
- How do I select values of an object two levels deep using LINQ?