I am looking 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 aim is based on the current location url, return the first Page object from its pages collection.
I have tried a number of different ways now and they all seem to execute many queries to get the desired Page object out.
Any help is appreciated!
Dave the Ninja