Views: 8.3K
Replies: 1
Archived
|
E.F 4.1 CodeFirst,Generic Repository Pattern,UoW,MVPHİ , I developed a windows form project with using E.F 4.1 CodeFirst model, Generic RepositoryPattern, Unit Of Work and MVP. I made 4 layers which are like below. DataAccessLayer (Entities like tblCustomers, tblUsers, Repositories like CustomerRepository,UserRepository) BusinessLayer PresenterLayer UI -->Windows Forms. My Problem is carrying exceptions beetween the layers and carriying the data between the layers. I made a DTO datatransfer objects which names like CustomerDto, UserDto. When I query generic repository forexample CustomerRepository<tblCustomers> it returns tblCustomer type data , but i want to fill CustomerDto class , so i have to write query business layer, But i have to this job in Data Access Layer , I dont want to carry tblCustomer entities between the layers. Is it correct what i have done, if wrong how can i do.. Thanks. Best Regards. Volkan Genç, May 11, 2012
|
|
Reply 1Volkan,
I've done similar things, and my suggestions are:
You can find out about AutoMapper at AutoMapper.org. I hope this helps. King Wilder // First configure the mapping... AutoMapper.Mapper.CreateMap<Source.Entity.Categories, Destination.CategoriesDto>(); // Then map the objects and return the newly mapped object. CategoryDto dto = AutoMapper.Mapper.Map<Source.Entity.Categories, Destination.CategoriesDto>(entity); King Wilder, Jun 01, 2012
|