title: How to solve No parameterless constructor defined for this object error in Mvc?
body: <p>I am creating one demo application to learn how to use repository pattern  for performing Insert operation.I am using Nop Commerce**(<a href="http://www.nopcommerce.com" rel="nofollow noreferrer">http://www.nopcommerce.com</a>) **code for repository pattern</p>
  
  <p><strong>Error</strong>:No parameterless constructor defined for this object</p>
  
  <p>I have seen this link:<a href="https://stackoverflow.com/questions/12605445/mvc-no-parameterless-constructor-defined-for-this-object#">MVC: No parameterless constructor defined for this object</a></p>
  
  <p>This is my Structure:</p>
  
  <p><strong>My Repository interface</strong>:</p>
  
  <pre><code>public partial interface IRepository&lt;T&gt;
      {
          void Insert(T entity);
       }
  </code></pre>
  
  <p><strong>My Service Layer</strong>:</p>
  
  <pre><code> public partial interface IEmployeeService
      {
          void InsertCategory(EmployeeMaster employeeMaster);
      }
  </code></pre>
  
  <p><strong>My Class which will implement that interface(service)</strong>:</p>
  
  <pre><code>public partial class EmployeeService : IEmployeeService
      {
          #region Fields
          private readonly IRepository&lt;EmployeeMaster&gt; _employeeMasterRepository;
          #endregion
  
          #region Ctor
          public EmployeeService
              (
              IRepository&lt;EmployeeMaster&gt; employeeMasterRepository
              )
           {
               this._employeeMasterRepository = employeeMasterRepository;
           }
  
          #endregion
  
  
  
  public virtual void InsertCategory(EmployeeMaster employeeMaster)
          {
              if (employeeMaster == null)
                  throw new ArgumentNullException("employeeMaster");
  
              _employeeMasterRepository.Insert(employeeMaster);
  }
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>public class HomeController : Controller
      {
          #region Fields
          private readonly IEmployeeService  _employeeService;
          #endregion
  
   #region Constructors
          public HomeController
          (
              IEmployeeService employeeService
          )
          {
              this._employeeService = employeeService;
          }
          #endregion
  </code></pre>
  
  <p>Getting Error:<strong>No parameterless constructor defined for this object</strong></p>
  
  <p>I have studied regarding this error and all the sources are saying that use Dependency injection to solve this error.</p>
  
  <p>Can anybody guide me how to use dependency injection to solve this error??</p>