motto
motto

Reputation: 1306

Getting "Linq is not a member of NHibernate.ISession" error when implementing Linq to NHibernate

I'm struggling with getting Linq To NHibernate to work. I have referenced NHibernate, NHibernate.Linq and NHibernate.ByteCode.Castle . Also I have all other dependencies in the same folder.

Code / Error message:

 Public Function GetProjectsByName(ByVal ProjectName As String) As List(Of Project)

    Return (From x In _session.Linq(Of Project)() Where x.Name.Equals(Project))

 End Function

"Linq is not a member of NHibernate.ISession"

... tells me that the LINQ extensions aren't loaded. Using NHibernate.Linq seems to be made in a way that it's incredibly easy to use, hence there are no tutorials on how to set it up. (Or at least I couldn't find any).

Do you have any idea, what I could be missing?

UPDATE: References of Data Access Layer

alt text

Thanks in advance

Upvotes: 1

Views: 645

Answers (1)

motto
motto

Reputation: 1306

Issue resolved! It was indeed due to different versions of assemblies, like Tomas Pajonk suggested.

The following assembly versions work together:

  • NHibernate 2.1.0.4000
  • NHibernate.Linq 1.0.0.4000
  • Castle.Core 1.1.0.0
  • Castle.DynamicProxy2 2.0.3.0 (2.0.3.4333)
  • Iesi.Collections 1.0.1.0
  • log4net 1.2.10.0
  • NHibernate.ByteCode.Castle 2.1.0.4000
  • Antlr3.Runtime 3.1.0.39271

Thanks to everybody who helped!

Upvotes: 6

Related Questions