Abhilash J A

Abhilash J A

  • NA
  • 2.4k
  • 583.2k

Entity framework with business layer and data access layer

Jan 4 2017 7:10 AM
Hello Everyone,
 
I have model.edmx file, DataAccessLayer, BussinessLayer and MVC. I have done DAL layer .dll referred inside BAL layer. How can I connect with each other without using AUTOMAPPER ?
 
DAL, 
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. using DAL.Model;  
  7.   
  8. namespace DAL  
  9. {  
  10.     public class ProductCategoryDAL  
  11.     {  
  12.         public List<AccessHistory> SelectAccessHistory(int idAccessHistory)  
  13.         {  
  14.             using (var context = new REBOXEntities())  
  15.             {  
  16.                 if (idAccessHistory > 0)  
  17.                     return context.AccessHistories.Where(s => s.idAccessHistory == idAccessHistory).ToList();  
  18.                 else  
  19.                     return context.AccessHistories.ToList();  
  20.             }  
  21.         }  
  22.     }  
  23. }  
 
 
BAL,
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Threading.Tasks;  
  6. using DAL;  
  7. using DAL.Model;  
  8.   
  9. namespace BAL  
  10. {  
  11.     public class ProductCategoryBAL  
  12.     {  
  13.         ProductCategoryDAL productCategoryDAL = new ProductCategoryDAL();  
  14.         public List<BAL.Model.AccessHistory> SelectAccessHistory(int idAccessHistory)  
  15.         {  
  16.             try  
  17.             {  
  18.                 List < BAL.Model.AccessHistory > objBALAccessHistory = productCategoryDAL.SelectAccessHistory(idAccessHistory).ToList(); /*Here occuring error*/  
  19.                 return objBALAccessHistory;  
  20.             }  
  21.             catch (Exception ee)  
  22.             {  
  23.                 throw ee;  
  24.             }  
  25.         }  
  26.     }  
  27. }  
 

Answers (4)