.netvb.netnhibernatelinq-to-nhibernate

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


Solution

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

    The following assembly versions work together:

    Thanks to everybody who helped!