I am using Automapper 6.2.2.0, which I think is the latest, in my web project (ASP.NET WebForms) and also in my Business layer, here is what Automapper is not mapping and don't know why:
Here is the relationship in the database, also exist the corresponding Business Objects and the Model of the Database (using LINQ to SQL)
this is the Automapper profile:
public class ServicePlanProfile: Profile
{
public ServicePlanProfile()
{
//ProcedureCodeUnits
CreateMap<ExtendedProcedureCodeUnit, ProcedureCodeUnit>().ReverseMap();
CreateMap<ExtendedProcedureCode, ProcedureCode>().ReverseMap();
CreateMap<ExtendedServiceCategory, ServiceCategory>().ReverseMap();
CreateMap<ExtendedServiceSubCategory, ServiceSubCategory>().ReverseMap();
}
}
have this code in the Global.asax file to kick off the Automapper configurations:
//Automapper configuration
Mapper.Initialize(
cfg=>
{
cfg.AddProfile<AutoMapperProfile>();
cfg.AddProfile<ServicePlanProfile>();
cfg.AddProfile<IncidentTrackingProfile>();
}
);
And here, following the steps in the Automapper docs, is the expression tree generated
Don't know why Automapper is not mapping ServiceCategoryID and ServiceSubCategoryID fields, any clue?