public object ExecuteExpression(Serialize.Linq.Nodes.ExpressionNode expressionNode) { using (var session = SessionFactory.OpenSession()) { var query = session.Query<object>(); var expression = expressionNode.ToExpression(new NHExpressionContext(session)); var result = query.Provider.Execute(expression); IEnumerable enumerable = result as IEnumerable; if (enumerable != null) return enumerable.Cast<object>().ToArray(); else return result; } }