title: MVC3 - Error setting up Controller with Entity framework
body: <p><strong>The steps I go through...</strong></p>
  
  <ul>
  <li><p>Add new ADO.NET Entity Data Model > Generate from DB > Setup new connection string to adventureworks db > Next > Select table "DatabaseLog" > Finish.  Verify DatabaseLog is visible in the edmx view.</p></li>
  <li><p>Right click controller > Add controller</p></li>
  <li><p>Template<br />Controller with read/write actions and views, using Entity</p></li>
  <li><p>Model class<br />
  AdventureWorksDWEntities</p></li>
  <li><p>Context<br />
  New data Context > Accept default name</p></li>
  <li><p>View<br />
  Razor</p></li>
  <li><p>Click Add.  </p></li>
  </ul>
  
  <p><strong>Produce Error:</strong><br />
  "Unable to retrieve metadata for 'DatabaseDocumentor.models.AdventureWorksDWEntities'.</p>
  
  <ul>
  <li><p>System.Data.Edm.EdmEntityeType:  EntityType 'AdventureWorksDWEntities' has no key defined.  Define the key for this entitytype.</p></li>
  <li><p>System.Data.Edm.EdmEntitySet:  EntityType:  EntitySet 'AdventureWorksDWEntities' is based on type 'AdventureWorksDWEntities' that has no keys defined.</p></li>
  </ul>
  
  <p><hr />
  I tried again using AdventureWorks (not AdventureWorksDW) and this time it worked. But, I still don't understand what to pick when generating a controller.  I have 3 options:</p>
  
  <p>Template<br />
  Here I picked Controller with read/write actions and views, using Entity.  This is easy enough to understand.  I want to have my tables generated for me so I pick this option.</p>
  
  <p>Model<br />
  This is what I want to model.  In this case I want to model the "Department" table.  So I choose Department.</p>
  
  <p>Context<br />
  This one is real fuzzy to me.  I chose *<em>Name</em>*Entities.  This is the value in the web.config connection strings area.  Why do I need to choose my connection string as the context?  I only know context as "an object that I use to get to my entities" in C#.  So, here it's hard for me to visualize.  Do I need to always choose my connection string for the context?</p>