ordering by a property on a joined table linq to sql
Posted
by Gazeth
on Stack Overflow
See other posts from Stack Overflow
or by Gazeth
Published on 2010-03-18T14:50:36Z
Indexed on
2010/03/18
14:51 UTC
Read the original article
Hit count: 150
linq-to-sql
|left-join
I have the following linq query
from o in context.Opportunities
join i in context.Interactions on o.OpportunityID equals i.OpportunityID into ints
from i in ints.DefaultIfEmpty()
orderby i.StatusID descending, o.StatusID descending
select o
Now i want to then do a distinct on the opportunities table but doing so removes my orderby. I know that you can do Distinct().OrderBy
but how do i get a reference to the interactions table that was joined when I'm only selecting the opportunity entity?
© Stack Overflow or respective owner