title: Error in Html.DisplayNameFor()
body: <p>I am learning  Entity Framework in MVC from</p>
  
  <p><a href="https://www.youtube.com/watch?v=8f4P8U1a2TI" rel="nofollow">https://www.youtube.com/watch?v=8f4P8U1a2TI</a></p>
  
  <p>in Index View ,it give following Error :</p>
  
  <p>CS0121: The call is ambiguous between the following methods or properties: 'System.Web.Mvc.Html.DisplayNameExtensions.DisplayNameFor and</p>
  
  <p>'System.Web.Mvc.Html.DisplayNameExtensions.DisplayNameFor,MvcApplication1.Models.Department></p>
  
  <p>Index View :</p>
  
  <pre><code>@model IEnumerable&lt;MvcApplication1.Models.Employee&gt;
  @{
      ViewBag.Title = "Index";
  }
  &lt;div style="font-family"&gt;
      &lt;h2&gt;
          Index&lt;/h2&gt;
      &lt;p&gt;
          @Html.ActionLink("Create New", "Create")
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;table border="1"&gt;
      &lt;tr&gt;
          &lt;th&gt; &lt;/th&gt;
  
      &lt;/tr&gt;
      @foreach (var item in Model)
      {
          &lt;tr&gt;
  
              &lt;td&gt;  @Html.DisplayNameFor(modelItem =&gt; item.Name)   &lt;/td&gt;
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  </code></pre>
  
  <p>Employee Controller :</p>
  
  <pre><code>namespace MvcApplication1.Controllers
  {
      public class EmployeeController : Controller
      {
          private EmployeeContext1 db = new EmployeeContext1();
  
          //
          // GET: /Employee/
  
          public ActionResult Index()
          {
              var employees = db.Employees.Include("Department");
              return View(employees.ToList());
          }
  
          //
          // GET: /Employee/Details/5
  
          public ActionResult Details(int id = 0)
          {
              Employee employee = db.Employees.Single(e =&gt; e.Id == id);
              if (employee == null)
              {
                  return HttpNotFound();
              }
              return View(employee);
          }
  
          //
          // GET: /Employee/Create
  
          public ActionResult Create()
          {
              ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name");
              return View();
          }
  
          //
          // POST: /Employee/Create
  
          [HttpPost]
          public ActionResult Create(Employee employee)
          {
              if (ModelState.IsValid)
              {
                  db.Employees.AddObject(employee);
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
  
              ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId);
              return View(employee);
          }
  
          //
          // GET: /Employee/Edit/5
  
          public ActionResult Edit(int id = 0)
          {
              Employee employee = db.Employees.Single(e =&gt; e.Id == id);
              if (employee == null)
              {
                  return HttpNotFound();
              }
              ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId);
              return View(employee);
          }
  
          //
          // POST: /Employee/Edit/5
  
          [HttpPost]
          public ActionResult Edit(Employee employee)
          {
              if (ModelState.IsValid)
              {
                  db.Employees.Attach(employee);
                  db.ObjectStateManager.ChangeObjectState(employee, System.Data.EntityState.Modified);
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
              ViewBag.DepartmentId = new SelectList(db.Departments, "Id", "Name", employee.DepartmentId);
              return View(employee);
          }
  
          //
          // GET: /Employee/Delete/5
  
          public ActionResult Delete(int id = 0)
          {
              Employee employee = db.Employees.Single(e =&gt; e.Id == id);
              if (employee == null)
              {
                  return HttpNotFound();
              }
              return View(employee);
          }
  
          //
          // POST: /Employee/Delete/5
  
          [HttpPost, ActionName("Delete")]
          public ActionResult DeleteConfirmed(int id)
          {
              Employee employee = db.Employees.Single(e =&gt; e.Id == id);
              db.Employees.DeleteObject(employee);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
  
          protected override void Dispose(bool disposing)
          {
              db.Dispose();
              base.Dispose(disposing);
          }
      }
  }
  </code></pre>
  
  <p>AutoGenerated Model Class :</p>
  
  <pre><code>  public partial class Employee : EntityObject
      {
          #region Factory Method
  
          /// &lt;summary&gt;
          /// Create a new Employee object.
          /// &lt;/summary&gt;
          /// &lt;param name="id"&gt;Initial value of the Id property.&lt;/param&gt;
          public static Employee CreateEmployee(global::System.Int32 id)
          {
              Employee employee = new Employee();
              employee.Id = id;
              return employee;
          }
  
          #endregion
  
          #region Primitive Properties
  
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
          [DataMemberAttribute()]
          public global::System.Int32 Id
          {
              get
              {
                  return _Id;
              }
              set
              {
                  if (_Id != value)
                  {
                      OnIdChanging(value);
                      ReportPropertyChanging("Id");
                      _Id = StructuralObject.SetValidValue(value);
                      ReportPropertyChanged("Id");
                      OnIdChanged();
                  }
              }
          }
          private global::System.Int32 _Id;
          partial void OnIdChanging(global::System.Int32 value);
          partial void OnIdChanged();
  
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
          [DataMemberAttribute()]
          public global::System.String Name
          {
              get
              {
                  return _Name;
              }
              set
              {
                  OnNameChanging(value);
                  ReportPropertyChanging("Name");
                  _Name = StructuralObject.SetValidValue(value, true);
                  ReportPropertyChanged("Name");
                  OnNameChanged();
              }
          }
          private global::System.String _Name;
          partial void OnNameChanging(global::System.String value);
          partial void OnNameChanged();
  
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
          [DataMemberAttribute()]
          public global::System.String Gender
          {
              get
              {
                  return _Gender;
              }
              set
              {
                  OnGenderChanging(value);
                  ReportPropertyChanging("Gender");
                  _Gender = StructuralObject.SetValidValue(value, true);
                  ReportPropertyChanged("Gender");
                  OnGenderChanged();
              }
          }
          private global::System.String _Gender;
          partial void OnGenderChanging(global::System.String value);
          partial void OnGenderChanged();
  
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
          [DataMemberAttribute()]
          public global::System.String City
          {
              get
              {
                  return _City;
              }
              set
              {
                  OnCityChanging(value);
                  ReportPropertyChanging("City");
                  _City = StructuralObject.SetValidValue(value, true);
                  ReportPropertyChanged("City");
                  OnCityChanged();
              }
          }
          private global::System.String _City;
          partial void OnCityChanging(global::System.String value);
          partial void OnCityChanged();
  
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
          [DataMemberAttribute()]
          public Nullable&lt;global::System.Int32&gt; DepartmentId
          {
              get
              {
                  return _DepartmentId;
              }
              set
              {
                  OnDepartmentIdChanging(value);
                  ReportPropertyChanging("DepartmentId");
                  _DepartmentId = StructuralObject.SetValidValue(value);
                  ReportPropertyChanged("DepartmentId");
                  OnDepartmentIdChanged();
              }
          }
          private Nullable&lt;global::System.Int32&gt; _DepartmentId;
          partial void OnDepartmentIdChanging(Nullable&lt;global::System.Int32&gt; value);
          partial void OnDepartmentIdChanged();
  
          #endregion
  
  
          #region Navigation Properties
  
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [XmlIgnoreAttribute()]
          [SoapIgnoreAttribute()]
          [DataMemberAttribute()]
          [EdmRelationshipNavigationPropertyAttribute("ComputerFirmModel", "FK__tblEmploy__Depar__4222D4EF", "tblDepartment")]
          public Department Department
          {
              get
              {
                  return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;Department&gt;("ComputerFirmModel.FK__tblEmploy__Depar__4222D4EF", "tblDepartment").Value;
              }
              set
              {
                  ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;Department&gt;("ComputerFirmModel.FK__tblEmploy__Depar__4222D4EF", "tblDepartment").Value = value;
              }
          }
          /// &lt;summary&gt;
          /// No Metadata Documentation available.
          /// &lt;/summary&gt;
          [BrowsableAttribute(false)]
          [DataMemberAttribute()]
          public EntityReference&lt;Department&gt; DepartmentReference
          {
              get
              {
                  return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference&lt;Department&gt;("ComputerFirmModel.FK__tblEmploy__Depar__4222D4EF", "tblDepartment");
              }
              set
              {
                  if ((value != null))
                  {
                      ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference&lt;Department&gt;("ComputerFirmModel.FK__tblEmploy__Depar__4222D4EF", "tblDepartment", value);
                  }
              }
          }
  
          #endregion
  
      }
  </code></pre>
  
  <p>... Please Suggest</p>