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,
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using DAL.Model;
- namespace DAL
- {
- public class ProductCategoryDAL
- {
- public List
SelectAccessHistory( int idAccessHistory) - {
- using (var context = new REBOXEntities())
- {
- if (idAccessHistory > 0)
- return context.AccessHistories.Where(s => s.idAccessHistory == idAccessHistory).ToList();
- else
- return context.AccessHistories.ToList();
- }
- }
- }
- }
BAL,
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using DAL;
- using DAL.Model;
- namespace BAL
- {
- public class ProductCategoryBAL
- {
- ProductCategoryDAL productCategoryDAL = new ProductCategoryDAL();
- public List
SelectAccessHistory( int idAccessHistory) - {
- try
- {
- List < BAL.Model.AccessHistory > objBALAccessHistory = productCategoryDAL.SelectAccessHistory(idAccessHistory).ToList(); /*Here occuring error*/
- return objBALAccessHistory;
- }
- catch (Exception ee)
- {
- throw ee;
- }
- }
- }
- }


Chetan RanpariyaRank #1,852 · 801 reputationPosted Jan 4, 2017, 4:52 AM EST
Tapan PatelRank #614 · 3.9K reputationPosted Jan 4, 2017, 3:48 AM EST
If you are going away from the automapper then you may want to write your own method (kind of conversion methods) in BAL that converts your entity objects to business & vice-a-versa.
Chetan RanpariyaRank #1,852 · 801 reputationPosted Jan 4, 2017, 3:12 AM EST
Abhilash J ARank #1,243 · 1.4K reputationPosted Jan 4, 2017, 5:38 AM EST