使用AutoMapper做对象映射时,报“Missing type map configuration or unsupported mapping.”类型错误

使用AutoMapper做对象映射时,报“Missing type map configuration or unsupported mapping.”

  1. 配置文件添加以下内容:
    使用AutoMapper做对象映射时,报“Missing type map configuration or unsupported mapping.”类型错误 startup.cs 文件中添加以下:
    通过AppDomain.CurrentDomain.GetAssemblies()扫描配置文件。
    使用AutoMapper做对象映射时,报“Missing type map configuration or unsupported mapping.”类型错误
    实际上发现并没有对MobanProfile配置文件进行扫描,导致报以下错误:
    使用AutoMapper做对象映射时,报“Missing type map configuration or unsupported mapping.”类型错误

  2. 解决方法:
    改为以下services.AddAutoMapper(typeof(MobanProfile).Assembly);
    问题解决。
    使用AutoMapper做对象映射时,报“Missing type map configuration or unsupported mapping.”类型错误
    参考:https://q.cnblogs.com/q/125627/