I having been curious for awhile about how Dapper (or perhaps other ORMs) handle object retrieval when combined with LINQ.
If I have a class like this:
public static IEnumerable<SitePage> GetAll()
{
using (IDbConnection cn = new SqlConnection(g.Global.CONX))
{
cn.Open();
return cn.GetAll<SitePage>();
}
}
and I construct a query like this:
var result = SitePage.GetAll().Select(c=> new { c.id, c.PageUrl, c.ParentId });
I am curious if in the background, the entire record set gets pulled in including all the other columns (which may contain really big varchars), or does Dapper understand from this query only to pull in the columns I request from the sql db? I realize it's sort of newbish, but I want to better understand the Dapper/LINQ interaction.
A similar question was posted here: selecting-specific-columns-using-linq-what-gets-transferred, though I wasn't sure if was fully answered. The poster had 2 questions, and also wasn't using lambda expressions which I generally prefer.
The answer to this will set my mind afire (and quite possibly change the way I am coding, as I have been cautious and feel I am writing too much code via explicit sql).