when I went to NHibernate's site I was directed to this forum. If you don't 
mind me asking....what is the correct forum? I didn't see any others.

This is the page that directed me to this forum:

https://forum.hibernate.org/viewtopic.php?f=25&t=994308




________________________________
From: DomZ <[email protected]>
To: nhusers <[email protected]>
Sent: Fri, October 30, 2009 9:26:12 AM
Subject: [nhusers] Re: Forcing inner join when using Linq to NHibernate


Hi Dan,

It seems that you post in the wrong thread, create a new thread and
remove this post please.

Regards

On Oct 30, 3:21 pm, Dan Normington <[email protected]> wrote:
> I posed this question a few days ago but I didn't see it show up, so if this 
> is a double post I appologize. I recently started using Linq to NHibernate 
> and was wondering if anybody knows how to force an inner join. I'm able to do 
> this easily with the typical criteria objects. I put a quick example below to 
> show querying a user by their username/password, but I'm also eagerly loading 
> the company.
>
> ICriteria query = _unitOfWork.CreateCriteria<User>();
> query.CreateAlias("Company", "comp", 
> NHibernate.SqlCommand.JoinType.InnerJoin);
> query.Add(Expression.Eq("UserName",userName));
> query.Add(Expression.Eq("Password", password));
> query.SetFetchMode("Company", FetchMode.Join);
> return query.UniqueResult<User>();
>
> I can "eagerly" load the company by using the "Expand" method with the linq 
> extensions for NHibernate, but it always joins with a "left outer join".
>
> INhibernateQueryable<User> query = _unitOfWork.Linq<User>();
> query.Expand("Company");
> return query.FirstOrDefault(user => user.UserName == userName && 
> user.Password == password);
>
> Any help would be appreciated.
>
> Thanks,
>   Dan


      
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to