title: getting Entity Framework raw query to respect attributes
body: <p>I'm using EF4, code first. As such, my model classes have a mix of public properties, some virtual properties (for lazy loaded data from other tables) and some properties that are affixed with <code>[NotMapped]</code> attributes so that they are skipped by EF. </p>
  
  <p>Sometimes I like to make use of the raw query : <code>c.Database.SqlQuery&lt;T&gt;("select ...")</code> to use EF as a row mapper. </p>
  
  <p>I noticed in Intellitrace that these queries were generating a lot of thrown and caught exceptions for "IndexOutOfRange". After some looking, the exceptions are all for the virtual and [NotMapped] properties on the model object. I don't want to have to construct a new data model class or parent class with just the table properties in it; is there some configuration step I've missed to tell the row mapper in the raw query runner to pay attention to the same annotations that the rest of EF uses? Maybe they fixed this in EF5?</p>