Converting a SQL Query to a Predicate Expression using Fluent Synatx

How do I write the following sql query to a Predicate Expression using Fluent Sytax:

select c.* from customer c
inner join Orders r on r.CustomerId = c.Id
where
    c.MemberSince > '01/01/2013' &&
    r.OrderDate > '01/01/2014'
order by r.OrderDate

I am expecting something like this:

Expression<Func<Customer, bool>> filters = PredicateBuilder.True<Customer>();
filters = filters.And(x => x.MemberSince > DateTime.Parse('01/01/2013'));
filterr = ....

I am not sure how to add the Orders predicate. And then I call:

var list = db.Customers.AsExpandable().Where(filters).ToList();
Jon Skeet
people
quotationmark

You don't need PredicateBuilder at all. You just need to understand that the result of a join is effectively a sequence of pairs:

DateTime memberCutoff = ...;
DateTime orderCutoff = ...;
var query = context.Customers
                   .Join(context.Orders,
                         c => c.Id, r => r.CustomerId, (c, r) => new { c, r })
                   .Where(pair => pair.c.MemberSince > memberCutoff &&
                                  pair.r.OrderDate > orderCutoff)
                   .OrderBy(pair => pair.r.OrderDate);

people

See more on this question at Stackoverflow