title: How to scaffold complex types with EF in ASP.NET MVC5?
body: <p>I wonder if there is more suitable approached to auto-scaffold complex type with several One-To-One and One-To-Many relations. Let's say I have type done with Code-First. </p>
  
  <pre><code>public class Bank
  {
      [Key]
      public Guid BankId { get; set; }
      public virtual BankProfile Profile { get; set; } 
      public virtual ICollection&lt;BankAccount&gt; Accounts { get; set; }
      public virtual ICollection&lt;AutomatedTellerMachine&gt; BankAutomatedTellerMachines { get; set; }
      public virtual ICollection&lt;BankOperationHistory&gt; BankOperationsHistory { get; set; } 
  
      public Bank()
      {
          BankId = Guid.NewGuid();
          Accounts = new List&lt;BankAccount&gt;();
          BankAutomatedTellerMachines = new List&lt;AutomatedTellerMachine&gt;();
          BankOperationsHistory = new List&lt;BankOperationHistory&gt;();
      }
  }
  </code></pre>
  
  <p>And I want to create some Create view where ALL fields from Bank-class and sub-classes like BankProfile-class are included. However, just simple scaffold Controller doesn't work and returns something like this view: (Html.Helpers here too...)</p>
  
  <pre><code>&lt;div class="form-horizontal"&gt;
      &lt;h4&gt;Bank&lt;/h4&gt;
      &lt;hr /&gt;
      @Html.ValidationSummary(true, "", new { @class = "text-danger" })
      &lt;div class="form-group"&gt;
          &lt;div class="col-md-offset-2 col-md-10"&gt;
              &lt;input type="submit" value="Create" class="btn btn-default" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I solved it with creating the VERY big form manually and data sent from VIew to Controller as a lot of string, int, double types. Is there a way to do something like this?:</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgery]
  public ActionResult CreateBank(Bank bank, BankProfile profile, List&lt;BankAccount&gt; accounts){...}
  </code></pre>
  
  <p>I found something similar to my question <a href="https://stackoverflow.com/questions/5864939/how-to-scaffold-complex-types-in-asp-net-mvc3">here</a>, but it doesn't show how to place all inputs for Bank\BankProfile in the one form. </p>