title: MVC 3, Entity Framework 4.x, Database First, Desperation
body: <p>VS2010 Pro + SqlServer Express.</p>
  
  <p>Having been dropped into ASP.NET MVC 3 with no guidance but the web (2 books on order), I can't even get off the ground.</p>
  
  <p>The MVC itself I get.  Not a problem.
  PHP, Ruby, and even ghastly WebForms firmly tucked into my toolbelt, with a long history of C++ QT client-server development before that.</p>
  
  <p>Tying ASP.NET MVC 3 to a <em>database</em> using EF4 ORM is killing me.
  <br>The goals:</p>
  
  <ol>
  <li>Use database modeled by DBA.  I can specify all naming conventions, but <em>code first is not an option</em>!</li>
  <li>Import to EDMX.  This will be regularly updated using VS tools from the DBA's DB, never edited directly.</li>
  <li>Generate partial classes from EDMX, for use as model.  This will regularly be updated using VS tools, never edited directly.</li>
  <li>Use 'buddy' to extend above model class with code as the Controllers/Views need.</li>
  <li>Intuitively use the resulting model, pass it to the view, retrieve posts into it for insert/save, etc...</li>
  </ol>
  
  <p>I've seen and read so many <a href="http://www.hanselman.com/blog/EntityFramework41ReleaseCandidateWithGoLiveWithFinalReleaseToFollowInAMonth.aspx" rel="nofollow noreferrer">blogs</a>, <a href="http://msdn.microsoft.com/en-us/data/gg685489" rel="nofollow noreferrer">forum</a> <a href="http://msdn.microsoft.com/en-us/data/gg685494" rel="nofollow noreferrer">posts</a>, <a href="http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-model-amp-database-first-walkthrough.aspx" rel="nofollow noreferrer">walkthroughs</a>, and <a href="https://stackoverflow.com/questions/5914345/best-way-to-approach-tying-in-entity-framework-4-database-first-and-mvc3">stack</a> <a href="https://stackoverflow.com/questions/5700464/asp-mvc3-database-first">overflow</a> <a href="https://stackoverflow.com/questions/6585201/mvc3-and-ef-data-first-what-are-the-best-practices">posts</a> regarding this very use case.
  I even <a href="http://blogs.msdn.com/b/adonet/archive/2011/05/18/ef-power-tools-ctp1-released.aspx" rel="nofollow noreferrer">tried riding the magic unicorn</a>, followed by the latest <a href="http://blogs.msdn.com/b/adonet/archive/2011/08/22/ef-4-2-beta-1-available.aspx" rel="nofollow noreferrer">4.2beta1 with DbContext generators</a>.</p>
  
  <p>But can't get off the ground.
  I follow instructions, but just not understanding how to <em>do</em> anything with it.
  What conventions does the 'buddy' require (if any)?  How do I use it?  How do I get data with it? How do I write data?
  Every example looks different.  MVC guides are always focused on the UI side.  EF guides don't cover usage in the MVC.</p>
  
  <p>These are basic questions, and I'm feeling like the most incompetent idiot in the WWW right now.</p>
  
  <p>Is anyone out there currently using MVC3 &amp; EF4.x in the way I describe above?</p>