nhibernate/nhibernate-core — pull request #82 by hazzik (2012-02-18 19:19:40+00:00)
Title: NH-3000: Linq - Function projections which is called on parameters generate incorrect HQL (regression)

```csharp

var lookup = new[] { 1, 2, 3, 4 }.ToDictionary(x => x, x => new { Codes = new[] { x } });
var query = from item in Session.Query()
select new
{
index = Array.IndexOf(lookup[item.Id].Codes, item.Id, 0)/7,
};

var result = query.ToList();

```

Throws the exception `NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' `

Solution is to force execution of some known (which can be translated into sql) instance methods in select clause on client side if method is called on parameter.

JIRA: https://nhibernate.jira.com/browse/NH-3000