Hi kwo, your code is very close, however I think the it should look like this:
Using PathEdges
var query =
(from user in metadata.Users
select user)
.WithPath(
new PathEdge<VMBoxesEntity>(UsersEntity.PrefetchPathVmboxes,
new PathEdge<VMMessagesEntity>(VMBoxesEntity.PrefetchPathVmmessages)),
new PathEdge<AgentEntity>(UsersEntity.PrefetchPathAgent,
new PathEdge<AgentSkillsEntity>(AgentEntity.PrefetchPathAgentSkills)));
Using Lambda expressions
var query =
(from user in metadata.Users
select user)
.WithPath(userPath => userPath
.Prefetch<VMBoxesEntity>(user => user.Vmboxes)
.SubPath(vmboxPath => vmboxPath.Prefetch<VMMessagesEntity>(vmb => vmb.Vmmessages))
.Prefetch<AgentEntity>(user => user.Agent)
.SubPath(agentPath => agentPath.Prefetch<AgentSkillsEntity>(a => a.AgentSkills)) );
You should use only one WithPath clause, the expression is a tree.
Let us know if you need further help