There's a way, but you have to create a method. It's not recommended to share prefetch path objects, predicates etc. as they're not thread safe.
I've illustrated it with the example below:
// original query
LinqMetaData metaData = new LinqMetaData(adapter);
var q = (from c in metaData.Customer
where !(new string[] { "FISSA", "PARIS" }.Contains(c.CustomerId))
select c).WithPath(customerPath => customerPath
.Prefetch<OrderEntity>(c => c.Orders).OrderByDescending(o => o.OrderDate).LimitTo(2)
.SubPath(orderPath => orderPath
.Prefetch(o => o.OrderDetails)
.Prefetch(o => o.Employee)));
reworked version with separate method
var q = (from c in metaData.Customer
where !(new string[] { "FISSA", "PARIS" }.Contains(c.CustomerId))
select c).WithPath(EntityFetches.CreatePPath());
// separate method:
private static Func<IPathEdgeRootParser<CustomerEntity>, IPathEdgeRootParser<CustomerEntity>> CreatePPath()
{
return customerPath => customerPath
.Prefetch<OrderEntity>(c => c.Orders).OrderByDescending(o => o.OrderDate).LimitTo(2)
.SubPath(orderPath => orderPath
.Prefetch(o => o.OrderDetails)
.Prefetch(o => o.Employee));
}
The method will simply produce the set of edges you want. It's full of specific elements for this query, but it's easy to make it a bit more generic of course.