开发者

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

开发者 https://www.devze.com 2022-12-12 19:03 出处:网络
I\'m struggling with getting Linq To NHibernate to work. I have referenced NHibernate, NHibernate.Linq and NHibernate.ByteCode.Castle . A开发者_开发知识库lso I have all other dependencies in the same

I'm struggling with getting Linq To NHibernate to work. I have referenced NHibernate, NHibernate.Linq and NHibernate.ByteCode.Castle . A开发者_开发知识库lso 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

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

Thanks in advance


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消