How can I create a reusable Entity Framework projection expression?
<p>In my database, there are tables with dozens of columns:</p>

<p><code>Table MyEntity:
int Id
string Name
string Email
...dozens of other columns I never use in this project
</code></p>

<p>The class generated by EF has properties for those extra columns, and a simple query gets all those extra columns, wastefully.</p>

<p>Instead, I want to have a thin class, like so:</p>

<p><code>class MyEntity
{
    public int Id;
    public string Name;
    public string Email;
}
</code></p>

<p>When I query, I want to create instances of my thin object, and obviously, I can do this:</p>

<pre><code>from x in MyEntity
select new MyEntity {Id = x.Id, Name = x.Name, Email = x.Email };
</code></pre>

<p>But I do this a lot, and typing out the properties every time gets very tedious (and error prone, because I could forget one).</p>

<p>So I'm trying to do something like this instead:</p>

<pre><code>from x in MyEntity
select x.ToLiteEntity();
</code></pre>

<p>But I'm not sure how to write <code>ToLiteEntity</code> so that it creates an <em>expression</em> that gets added to the query, so that it knows to select only the needed columns from the database. How can I do this?</p>