title: Why is MVC3 not scaffolding my foreign key columns
body: <p>I'm trying to use MVC 3 with EF 4.1 using code first and am following Scott Guthries tutorial  <a href="http://weblogs.asp.net/scottgu/archive/2011/05/05/ef-code-first-and-data-scaffolding-with-the-asp-net-mvc-3-tools-update.aspx" rel="nofollow">http://weblogs.asp.net/scottgu/archive/2011/05/05/ef-code-first-and-data-scaffolding-with-the-asp-net-mvc-3-tools-update.aspx</a>.</p>
  
  <p>The issue I'm having is that when I create the products controller and the related scaffolded views, there is no "category" column being created in any of the views ("edit", "create", "index" etc),  which according to the tutorial should be created.</p>
  
  <p>I've traced the reason why the column is not being shown is because of the t4 templates... it is failing a check to see if it is a bindable type in order to display the property as a column.</p>
  
  <p>The logic for checking if it is bindable is:</p>
  
  <pre><code>bool IsBindableType(Type type) {
  return type.IsPrimitive || bindableNonPrimitiveTypes.Contains(type);
  }
  </code></pre>
  
  <p>Where bindableNonPrimitiveTypes is a fixed list:</p>
  
  <pre><code>static Type[] bindableNonPrimitiveTypes = new[] {
  typeof(string),
  typeof(decimal),
  typeof(Guid),
  typeof(DateTime),
  typeof(DateTimeOffset),
  typeof(TimeSpan),
  };
  </code></pre>
  
  <p>I have just installed VS2010 sp1, EF 4.1 and the MVC3 Tools Update referenced by the tutorial.
  I'm sure I've followed all the steps...</p>
  
  <p>Where am I going wrong/What am I missing?</p>