I want to do the following with a single database query, if possible.
public class Location
{
public string URL {get;set;}
public IList<Page> Pages {get;set;}
}
Page firstPage = Session.Linq<Location>()
.Where(location => location.URL == "some-location-url")
.Select(location => location.Pages).FirstOrDefault();
My goal is based on the current location url, returning the first page object from its collection.
I tried several different ways, and they all all seem to do a lot of queries to get the desired page object.
Any help is appreciated!
Dave Ninja
source
share