首页 > 解决方案 > Automapper Compile Mappings asp.net core

问题描述

I'm using the following syntax in my asp.net core startup class to configure automapper:

services.AddAutoMapper(c => c.AllowNullCollections = true, AppDomain.CurrentDomain.GetAssemblies());

I'd like to be able to compile the mappings at startup.

According to the Automapper docs, I should be able to do so via:

var configuration = new MapperConfiguration(cfg => {});
configuration.CompileMappings();

How do I get access to the mapping configuration using AddServices syntax?

标签: automapper

解决方案


推荐阅读