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
This might be what your looking for:
I’m making the assumption that the page has a Location property that relates back to the Location it belongs to and the .Index would be the property you want to order with.