Profile Reuse on Automapper

时间:2019-03-19 15:15:39

标签: c# oop automapper

i have a base mapping profile class BaseMapping : MappingProfile, which containts this method

protected void Map_TAB1_to_Ent()
{
  CreateMap<TAB1, Ent>()
   .ForMember(dest => dest.Id, opt => opt.MapFrom(r => Guid.NewGuid()));
}

And the derived class

  protected class EntMapping : BaseMapping
  {
    public EntMapping()
    {
      Map_TAB1_to_Ent();
      Map_DataRow_to_Cambio();
    }
  }

When i try to use it in the controller, in this way;

AutoMapper.Mapper.Map<TAB1, Ent>(variable)

I have an error of unresolved mapping; how is it possible? Am i wrong?

0 个答案:

没有答案