更新时间:2023-09-21 10:58:07
您需要添加此nuget包将AutoMapper.Extensions.Microsoft.DependencyInjection 添加到您的项目,然后将 AutoMapper
添加到您的 ServiceCollection
像这样
You need to add this nuget package AutoMapper.Extensions.Microsoft.DependencyInjection to your project and add AutoMapper
to your ServiceCollection
like this
var services = new ServiceCollection();
services.AddAutoMapper(mapperConfig => mapperConfig.AddProfiles(GetType().Assembly))
ServiceProvider = services.BuildServiceProvider();