I'm only dealing with one database table / entity object: NodePath.
Given a particular Node, I want to get only a subset of all its NodePaths according to this query:
select
*
from
NodePath
where
NodeId = @GivenNodeId and
Id in
(
--active paths
select
a.Id
from
NodePath a join
(
select
[Path],
max(Created) as Created
from
NodePath
group by
[Path]
) b on
a.[Path] = b.[Path] and
a.Created = b.Created
)
How can I execute this in my VB.NET application?
Dim AllPaths = GivenNode.NodePaths.OrderByDescending(Function(p) p.Created)
Dim ActivePaths = ???