Apparently the current NHibernate Linq provider cannot combine Max() and an inner Select in the Select clause. You may need to pull the Max out of the Query and apply it afterwards, e.g.
int maxCount = session.Query<Device>() .Select(d => d.DeviceSensors.Count) .ToList() .Max();
A simpler version without a sub select works:
int maxCount = session.Query<Device>() .Select(d => d.Name.Length) .Max();
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- LINQ Source Code Available
- creating Linq to sqlite dbml from DbLinq source code
- NHibernate LINQ query throws error "Could not resolve property"
- NHibernate LINQ query performance, which code fragment is better?
- Understanding the various options for runtime code generation in C# (Roslyn, CodeDom, Linq Expressions, ...?)
- Nhibernate 3 Linq throws Antlr.Runtime.NoViableAltException
- Why this Linq code always throws System.StackOverflowException?
- source code for LINQ 101 samples
- LINQ - changing Data Source (and the LINQ Provider) at runtime in C#
- How to dynamically create linq code at runtime and get results
- c# Linq or code to extract groups from a single list of source data
- Convert string to int in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- NHibernate vs LINQ to SQL
- Linq code to select one item
- Fetch vs FetchMany in NHibernate Linq provider
- LINQ on the .NET 2.0 Runtime
- How are people unit testing code that uses Linq to SQL
- Linq for NHibernate and fetch mode of eager loading
- Tradeoffs using NHibernate 3.0 QueryOver or LINQ provider
- Nhibernate Linq In Clause
- NHibernate query runs only once, then throws InvalidCastException
- Mocking Delegate.Invoke() using Moq throws InvalidCast exception in LINQ
- Getting count with NHibernate + Linq + Future
- NHibernate Second Level Cache With NHibernate Linq Provider 1.0
- Nhibernate 3 & LINQ
- How to do a case-insensitive string where in NHibernate Linq query?
- Syntax to execute code block inside Linq query?
- LINQ to Nhibernate duplicates joins
- Performance linq group by with count
- How do I combine LINQ expressions into one?
- Null check for reflected property's value with Any() keyword
- .net mvc limit results with show more link
- C#: Groupby, Difference of data in dataset
- Intersecting with LINQ on single column
- Using Linq on a Client Object model result from sharepoint
- Order string like numeric
- In VB.NET, which LINQ to SQL Left-Join method is best to use?
- LINQ query returns error "The expected type was 'System.Int32' but the actual value was null."
- Reason not to use LINQ
- C# linq Sum() extension for large numbers
- LINQ OrderBy based on row values
- How to Create a Run-Time Computed (NotMapped) Value in Entity Framework Code First
- Remove lines from List<String> using Linq, if meeting a certain criteria
- Linq using case
- Find project by Person Category
- Mutli Parameter Linq Query
- multiple conditions Linq extended
- How to rollback changes to WPF DataGrid control using LINQ-to-SQL?