Hi.
I'm developing a project using a layered architecture. I have a DAL in which i'm using Entity Framework, a business logic layer which consumes the objects returned by the DAL and an app layer.
I'm not entirely sure i'm thinking this right, so i'll just ask you what you think.
My DAL is based on mappers. I have types - mappers - that the BLL uses to operate on my data. These mappers return DTO's, because i did not want to expose to my BLL any EF objects so their implementations are not dependent on EF to work.
All these mappers do are CRUD actions on a single 'table', like:
using (var contex = new EFEntities()){
var obj = (from x in context.Table where x.ID == param select x).SingleOrDefault;
return Map(x.ToList());
}
The Map method maps the EF object to a DTO, which has only some properties to map the values i want to expose.
Is there a more elegant approach to this? I am just using EF to facilitate the access to my database - i don't have to write any ADO.NET code.
Any input on this would be welcome.
Thanks.