title: Why am I getting a Missing type map configuration error?
body: <p>I’ve modified this ContosoUniversity tutorial:  <a href="http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application" rel="nofollow">http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application</a> and now I’m trying to use AutoMapper to map object-to-object. </p>
  
  <p>Here’s my ModelView:</p>
  
  <pre><code>public class InstructorIndexData
  {
      public IEnumerable&lt;Instructor&gt; Instructors { get; set; }
      public IEnumerable&lt;Course&gt; Courses { get; set; }
      public IEnumerable&lt;Enrollment&gt; Enrollments { get; set; }
      public IEnumerable&lt;Student&gt; Students { get; set; }
      public IEnumerable&lt;Assignment&gt; Assignments { get; set; }
  }
  </code></pre>
  
  <p>Here’s the view</p>
  
  <pre><code>@model SchoolIn.ViewModels.InstructorIndexData
  
  @using SchoolIn.Models
  @{ViewBag.Title = "Index";}
  
  
  @using (Html.BeginForm("ClassAttendance", "Attendance", 
      new { currentDate = day, id = @ViewBag.ID, 
          teacher = HttpContext.Current.Session["sTeacher"], 
          courseID = HttpContext.Current.Session["sCourseID"] }, FormMethod.Post))
  
  {
      var wekdys = new Enrollment(); @*had too create this to have access to the dropdownList*@
      @Html.DropDownList("weekDays", wekdys.WeekDays.Select(s =&gt; 
          new SelectListItem { Text = s.ToString(), Value = s.ToString() }))
  
      @Html.ValidationSummary(true)
      &lt;p&gt;&lt;/p&gt;
      &lt;Input Type ="submit" Value="ClassAttendance"/&gt;
      &lt;p&gt;@Html.ActionLink("Create Todays Attendance", "Create")&lt;/p&gt;
      &lt;p&gt;@Html.ActionLink("Create New", "Create")&lt;/p&gt;
      &lt;h3&gt;Students Enrolled in @ViewBag.teacherName's @ViewBag.courseTitle Course&lt;/h3&gt;  
      &lt;table&gt;  
          &lt;tr&gt;  
              &lt;th&gt;View Student Report&lt;/th&gt; 
              &lt;th&gt;First Name&lt;/th&gt;  
              &lt;th&gt;Last Name&lt;/th&gt; 
              &lt;th&gt;Grade&lt;/th&gt;  
              &lt;th&gt;Attendance Code&lt;/th&gt;  
              &lt;th&gt;Class Day&lt;/th&gt; 
          &lt;/tr&gt;  
          @foreach (var item in Model.Enrollments)
          {  
          &lt;tr&gt;  
              &lt;td&gt;  
                  @Html.ActionLink("Report", "UpdateAttendance", "Attendance", 
                      new { 
                          grade=item.Grade, 
                          studentFirstName = item.Student.FirstMidName, 
                          studentLastName = item.Student.LastName, 
                          courseTitle = item.Course.Title, 
                          teacher = @ViewBag.teacherName }, null)
              &lt;/td&gt; 
              &lt;td&gt;@Html.EditorFor(modelItem=&gt;item.Student.FirstMidName)&lt;/td&gt;  
              &lt;td&gt;@Html.EditorFor(modelItem=&gt;item.Student.LastName)&lt;/td&gt; 
              &lt;td&gt;@Html.EditorFor(modelItem =&gt;item.Grade)&lt;/td&gt;
              &lt;td&gt;@Html.DropDownList("attendanceCode", item.attendanceCode.Select(s =&gt; 
                   new SelectListItem { Text = s.ToString(), Value = s.ToString() }))
                  @*Html.EditorFor(modelItem =&gt;item.attendanceCode)*/*@
              &lt;/td&gt;  
              &lt;td&gt;@Html.EditorFor(modelItem=&gt;item.classDays)&lt;/td&gt;
          &lt;/tr&gt;  
          }  
      &lt;/table&gt;  
  }
  </code></pre>
  
  <p>Here’s the method in my controller that I’m having problems with. I’m trying to use this example: <a href="http://chriscurrie.co.uk/blog/2011/09/coding/net/mvc/use-automapper-to-map-viewmodels-to-entities-mvc3-and-razor/" rel="nofollow">http://chriscurrie.co.uk/blog/2011/09/coding/net/mvc/use-automapper-to-map-viewmodels-to-entities-mvc3-and-razor/</a></p>
  
  <pre><code>public class AttendanceController : Controller
  {
      private SchoolInDB db = new SchoolInDB();
  }
  </code></pre>
  
  <p>code here…</p>
  
  <pre><code>[HttpPost]
  public ActionResult ClassAttendance(InstructorIndexData viewModel)
  {
  
  
      if (ModelState.IsValid)
      {
  
          AutoMapper.Mapper.CreateMap&lt;AttendanceData, Assignment&gt;();
          AutoMapper.Mapper.CreateMap&lt;AttendanceData, Enrollment&gt;();
          AutoMapper.Mapper.CreateMap&lt;AttendanceData, Student&gt;();
          AutoMapper.Mapper.CreateMap&lt;AttendanceData, Instructor&gt;();
  
          Instructor newInstructor = new Instructor();
          Student newStudent = new Student();
          Assignment newAssignment = new Assignment();
          Enrollment newEnrollment = new Enrollment();
  
          AutoMapper.Mapper.Map(viewModel, newInstructor );
          AutoMapper.Mapper.Map(viewModel, newStudent);
          AutoMapper.Mapper.Map(viewModel, newEnrollment);
          AutoMapper.Mapper.Map(viewModel, newAssignment);
  
          db.Assignments.AddObject(newAssignment).;
  
          db.SaveChanges();
          return RedirectToAction("Index");
      }
  
      return View();
  }
  </code></pre>
  
  <p>When I debug my code stops here ‘AutoMapper.Mapper.Map(viewModel, newInstructor );’ with this error: 
  Missing type map configuration or unsupported mapping.</p>
  
  <p>Mapping types:
  InstructorIndexData -> Instructor
  SchoolIn.ViewModels.InstructorIndexData -> SchoolIn.Models.Instructor</p>
  
  <p>Destination path:
  Instructor</p>
  
  <p>Source value:
  SchoolIn.ViewModels.InstructorIndexData</p>
  
  <p>Any iI also noticed that in my ActionResult(InstructorIndexData viewModel), viewModel has all null values.  </p>