In the Microsoft EF tutorial Efficient Querying, the section Project only properties you need describes how to make EF load only specific columns by projecting the entity queryable to an anonymous type. They don’t provide a code example, but to extend their other examples, it might look like this:
context.Blogs.Select(b => new { b.Id, b.Url })
My question is, will EF also recognize what you’re doing and load only the required columns if you project to a named type like this?
context.Blogs.Select(b => new Blog { Id = b.Id, Url = b.Url })
Or like this?
context.Blogs.Select(b => new Blog(b.Id) { Url = b.Url })