代码之家  ›  专栏  ›  技术社区  ›  Simon Thompson

VB中使用NHibernate时的LINQ字符串比较

  •  1
  • Simon Thompson  · 技术社区  · 16 年前

    当作为linq表达式的where部分与NHibernate的linq进行字符串比较时遇到问题。

    from x in NhibernateObject
    where x.StringCol = "value"
    select x
    

    http://jason.pettys.name/archive/2009/09/28/nhibernate-with-linq-error-with-string-comparisons-in-vb.net.aspx

    但我的问题是什么是“访客”和我会写什么代码来实现上面文章中强调的解决方案-这里缺少链接!!!

    2 回复  |  直到 16 年前
        1
  •  0
  •   Paco    16 年前

    操作而不更改其操作的元素的类。”

    要更改的访问者的命名空间是NHibernate.Linq.Visitors。在NHibernate.Linq中使用VB而不是C#可能会有更多的困难,因为VB3不支持C#3的所有功能。如果您使用.NET4.0(或c#当然)这些问题将得到解决

        2
  •  1
  •   M4N    16 年前

    http://www.dofactory.com/Patterns/PatternVisitor.aspx 或者在这里 http://en.wikipedia.org/wiki/Visitor_pattern

    如果我正确理解了你链接的文章(还没有完全阅读),那么就需要更改NHibernate来解决这个问题。