0

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:

enter image description here

Here is the relationship in the database, also exist the corresponding Business Objects and the Model of the Database (using LINQ to SQL)

enter image description here

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 enter image description here

Don't know why Automapper is not mapping ServiceCategoryID and ServiceSubCategoryID fields, any clue?

ddieppa
  • 5,866
  • 7
  • 30
  • 40

0 Answers0