title: How to Map Columns of Stored Procedure return to POCO class in Entity Framework 4.3
body: <p>I am using Entity Framework CodeFirst with an existing database. I have an existing stored procedure which returns data from a <code>Customer_Info</code> table with 2 columns <code>Customer_ID, Customer_Name</code>. I created a class for this entity called <code>Customer</code> with 2 Properties <code>CustomerID, CustomerName</code>. Now I am trying to get the data via this Stored Procedure. I have my Mapping defined like this in my <code>OnModelCreating</code> method.</p>
  
  <pre><code>modelBuilder.Entity&lt;Customer&gt;().ToTable("Customer_Info");
  modelBuilder.Entity&lt;Customer&gt;().
                   Property(x =&gt; x.CustomerID).HasColumnName("Customer_ID");
  </code></pre>
  
  <p>This is how i am trying to get data from the stored proc and load the data into the entity.</p>
  
  <pre><code>public IList&lt;Customer&gt; GetCustomers()
  {
    return context.Database.SqlQuery&lt;Customer&gt;("exec GetCustomers @p0","NY")
                                                                         .ToList();
  }
  </code></pre>
  
  <p>But it did not work ! It is throwing me an error saying like this</p>
  
  <blockquote>
    <p>The data reader is incompatible with the specified 'Customer'. A
    member of the type, 'CustomerID', does not have a corresponding column
    in the data reader with the same name.</p>
  </blockquote>
  
  <p>How do i fix this ? If i read from the table directly, my property mapping works.</p>