我正在使用遺留數據,這往往會使我在多列中分割出一個信息。我試圖重現以下SQL查詢...NHibernate QueryOver:從範圍''引用的'SomeTable'類型的變量'line',但沒有定義
SELECT * FROM SomeTable WHERE concat(DescriptionPart1,DescriptionPart2) LIKE 'TEST'
...使用NHibernate QueryOver。所以:
Dim myQuery = Me.Session.QueryOver(Of SomeTable).WhereRestrictionOn(_
Function(line As SomeTable) line.DescriptionPart1 & line.DescriptionPart2) _
.IsLike("TEST")
這自己的發言會遇到以下異常:
Variable 'line' of type 'SomeTable' referenced from scope '', but it is not defined
任何方向?我試圖避免魔法字符串,但我總是放棄它(因爲使用HQL,連接表達式+像函數一樣起着魅力的作用)。