title: How to map Entity Framework model classes with Business Layer class in n-tier architecture - ASP.NET-MVC
body: <p>I am working on e-tier architecture within MVC framework (ASP.NET MVC5, Entity Framework 6). My application is divided into three sub-projects which are Business-Layer, Data-Access-Layer, Repository (This include repository and Unit of Work) and ASP.NET MVC web-app. I am struggling to understand mapping between business data and entity framework model. for example if I have model class User in entity framework as </p>
  
  <h2>DAL - User Model</h2>
  
  <pre><code>[Table("User")]
  public class User
  {
      public User() { }
  
      [Key]
      public int UserID { get; set; }
  
      [StringLength(250)]
      [Required]
      public string FirstName { get; set; }
  
      [StringLength(250)]
      [Required]
      public string LastName { get; set; }
  
      [Required]
      public int Age { get; set; }
  
      [StringLength(250)]
      [Required]
      public string EmailAddress { get; set; }
  
      public ICollection&lt;UserInGroup&gt; UserInGroup { get; set; }
  }
  </code></pre>
  
  <p>and in business layer I have user class</p>
  
  <h2>BLL - User Class</h2>
  
  <pre><code>public class User
  {
      private string userID;
      private string firstName;
      private string lastName; 
      private int age;
      private string emailAddress;
  
  
      public string UserID
      {
          get { return userID; }
          set { userID = value; }
      }
  
      public string FirstName
      {
          get { return firstName; }
          set { firstName = value; }
      }
  
      public string LastName
      {
          get { return lastName; }
          set { lastName = value; }
      }
  
      public int Age
      {
          get { return age; }
          set { age = value; }
      }
  
      public string EmailAddress
      {
          get { return emailAddress; }
          set { emailAddress = value; }
      }
  
      public void GetAllUser()
      {
          List&lt;App.DAL.Model.User&gt; _user = new List&lt;DAL.Model.User&gt;();
  
          using (var _uow = new UserManagement_UnitOfWork())
          {
  
              _user = (from u in _uow.User_Repository.GetAll()
                       select u).ToList();
  
          }           
      }
  }
  </code></pre>
  
  <p>How I map together and secondly; referring to method GetAllUser(), I still need to use User model class from DAL in order to get all the users from database, where is my current understanding is; each layer should be independent to each other and I have abstraction layer i.e. repository between data access layer and business layer. I am slightly confused of both concept working together. Am I on right track or missing something. also need practical answer on User business layer.</p>