A provider for NHibernate library for .NET Framework which allows to use LINQ queries. Available since version 3.0.
Questions tagged [linq-to-nhibernate]
629 questions
0
votes
1 answer
Linq get child from Parent.Child.child
I have a table structure similar to the following
Table1 (ID (UniqueIdentifier))
Table2 (ID,(UniqueIdentifier) Table1ID (UniqueIdentifier), Table3ID (UniqueIdentifier))
Table3 (ID (UniqueIdentifier), Desc)
Table 3 will have a unique Desc, and when…

dave2118
- 206
- 6
- 22
0
votes
1 answer
Linq to NHibernate - How to return a parent object with only certain child objects included
Given a simplified model like the following:
public class Enquiry
{
public virtual DateTime Created { get; set; }
public virtual Sender Sender { get; set; }
}
public class Sender
{
public virtual IList Enquiries { get; set;…

vakman
- 494
- 4
- 12
0
votes
1 answer
How to perform a execution time query using Linq to NHibernate
I am inserting a record into my table, but I want to be able to set my
SortOrder field on insert to SELECT MAX(SortOrder) + 1 FROM Category
WHERE SiteID = @SiteID. What is the easiest way of doing this?
Here is my data…

Mike Cole
- 14,474
- 28
- 114
- 194
0
votes
1 answer
Select only specific columns in Nhibernate IQueryable
I have an entity that is mapped (using Fluent Nhibernate) to a view in the database.
The view has many columns, but the user can choose the columns that he wants to see in a report. I would like the resulting database query to only contain those…

Guillermo Vasconcelos
- 1,701
- 2
- 17
- 30
0
votes
2 answers
LINQ self referencing query
I have the following SQL query:
select
p1.[id],
p1.[useraccountid],
p1.[subject],
p1.[message],
p1.[views],
p1.[parentid],
max(
case
when p2.[created] is null then p1.[created]
else…

Chris
- 27,596
- 25
- 124
- 225
0
votes
1 answer
LINQ to NHibernate query only returning last matching item, not all matching items
This LINQ query should return all Recipes having a RecipeLineItem whose Ingredient title equals "Chocolate." Unfortunately, my query is only returning the last Recipe that matches my criteria, not all Recipes that match my criteria.
The problem…

David Alan Condit
- 1,243
- 11
- 20
0
votes
1 answer
Group by and order by
using LINQ to NHibernate does anybody know how to use group by and order by in the same expression. I am having to execute the group by into a list and then order this, seem that I am missing soemthing here ???
Example:-
Private function…

Simon Thompson
- 708
- 6
- 14
0
votes
1 answer
Change parameters to fixed values in offset\fetch clause
I am using NHibernate with Progress OpenEdge 11.3 Update 2 ODBC Driver. The driver (or OpenEdge) does not allow parameters in offset\fetch clauses. The offset\fetch clause must contain fixed values. According to the documentation and this…

Marius
- 239
- 3
- 11
0
votes
2 answers
How to perform join using LINQ for NHibernate
Can i join two tables using LINQ for NHibernate like I can do in LINQ To SQL?

Illuminati
- 4,539
- 2
- 35
- 55
0
votes
1 answer
Linq-to-NHibernate - How to do a Join with a SelectMany
Is it possible in Linq-to-NHibernate to do a Join with a SelectMany within the same query?
It might look weird, but the idea would be to generate the following query:
select * from State
join (
select CityId, StateId
from State
inner join City on…

Samuel Poirier
- 1,240
- 2
- 15
- 30
0
votes
4 answers
Is there any work-around for NHibernate-to-LINQ not supporting subqueries?
I know LINQ-to-NHibernate currently does not support sub-queries (http://ayende.com/Blog/archive/2009/07/26/nhibernate-linq-1.0-released.aspx).
Is there any workaround about it?

Afshar Mohebi
- 10,479
- 17
- 82
- 126
0
votes
2 answers
ArgumentOutOfRangeException using ToString in LINQ to NHibernate query
I have a basic NHibernate.Linq query:
var items = from item in session.Linq()
where item.ID > 0
select new { ID = item.ID, Type = item.ClassName };
This works fine. However, ObjectType is a heavy-weight class,…

Dathan
- 7,266
- 3
- 27
- 46
0
votes
1 answer
Nested select not working in NHibernate.Linq
I want to load the list of users and their roles, with this query:
var q = from u in session.Linq()
select new
{
u.Name,
u.Password,
Roles = from r in u.Roles
…
0
votes
1 answer
Nhibernate returns wrong results
I have this code:
lock (m_session)
{
var _result = m_session.Query().Where(c => c.StorageId == storageName && c.ContainerId == null).FirstOrDefault();
if…

Lev
- 434
- 2
- 9
0
votes
2 answers
Linq Expression to SQL text within NHibernate data context
Assuming that I have setup NHibernate data context with all relations, tables, connection etc.
How I would convert an instantiated .NET Expression (actually it's not a full SELECT but just a WHERE expression) to an SQL string?
I've seen many…

Eugene Tiutiunnyk
- 180
- 4
- 12