Reputation: 26874
I recently decided to upgrade my web application from NHibernate 2.1 to 3.0, the latest version of NH. I also decided to upgrade from .NET 2.0 to 3.5 for best compatibility with Mono (the webapp runs only in Linux) now that it's mature enough.
I wanted to play a bit with LINQ and NHibernate, since I also saw that the NHibernate.Linq namespace is included in the release.
However, when I try to write a LINQ using the ISession
instance, I don't get the Linq<T>
method.
I read i many old blog posts that in order to use LINQ to NH you must use the NHContrib package.
Do I still need to download NHContrib? Version 3.0 of NH is much more recent than NHContrib's LINQ to NH, and I saw the Linq namespace included in the release
is it due to the Visual Studio 2010 upgrade with 2.0->3.5 framework upgrade? I double-checked and target framework IS 3.5.
Unfortunately, I can't find comprehensive documentation on NH 3.0 except the full class documentation, which is more useful for NH developers than general-purpose development
Thank you.
Upvotes: 2
Views: 811
Reputation: 20049
Also be aware that the inbuilt LINQ provider doesn't supprort the .Equals
method in Where
clauses, you need to use ==
instead. For instance, where the following used to work with NHibernate.Linq in 2x:
(from e in myEntities where e.Name.Equals(nameLookup) select e)
You now need to do
(from e in myEntities where e.Name == nameLookup select e)
Upvotes: 0
Reputation: 18796
NHibernate 3.0 has it's own LINQ providerb built in, you can access it via .Query<T>
So you don't need Ayende's NHibernate.Linq provider anymore.
Also, the NHibernate 3.0 Cookbook may help you out.
https://www.packtpub.com/nhibernate-3-0-cookbook/book
Upvotes: 7