title: How to bind EF Code First DbContext to an Asp.Net DataSource?
body: <p>I've created the following <code>Context</code> to be used with <strong>Entity Framework <em>Code First</em></strong>:</p>
  
  <pre><code>public class Context : DbContext
      {
          public DbSet&lt;Animal&gt; Animals { get; set; }
      }
  </code></pre>
  
  <p>Now I would like to use this <code>Context</code> in an Asp.Net application to perform <strong>CRUD</strong> operations using a <code>GridView</code>. I need to create a <code>DataSource</code> to do the data binding. How would I go about?</p>
  
  <p>The ASP part would look like this:</p>
  
  <pre><code>&lt;asp:GridView runat="server" DataSourceID="animalDataSource" DataKeyNames="AnimalID" AutoGenerateColumns="false"&gt;   
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="Description" HeaderText="Description" /&gt;
          &lt;asp:CommandField ShowCancelButton="true" ShowEditButton="true" ShowDeleteButton="true" /&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>