title: Using LINQ to select EF properties in DBSet with specific Attributes
body: <p>Is there a way to perform a LINQ query on Entity Framework DBSets and only return the properties that have a specific custom attribute?</p>
  <p>My goal is to perform a query and return only the properties/columns that I need for an export.</p>
  <p>I also want to make this an extension for IEnumerable as I have many separate EF Classes that will use this export attribute.</p>
  <p>This is how I am visualizing it:</p>
  <pre><code>public class Person
  {
      [Export]
      public string FirstName { get; set; }
  
      [Export]
      public string LastName { get; set; }
  
      [Export]
      public string Address { get; set; }
  
      [NeverExport]
      public string SocialSecurityNumber { get; set; }
  }
  
  public void main()
  {
      var people = PersonRepository.GetAll();
      var exportResults = people.GetByAttribute(ExportAttribute);
  {
  
  public static IEnumerable&lt;object&gt; GetByAttribute(this IEnumerable&lt;object&gt; list, Attribute attribute)
  {
      return list
          .Select(x =&gt;
             // Select properties with { attribute } (ie. [Export])
          );
  }
  </code></pre>