在以前版本的AutoMapper中,我曾经能够像这样配置AutoMapper:
public static class AutoMapperFactory
{
public static IConfigurationProvider CreateMapperConfiguration()
{
var config = new MapperConfiguration(cfg =>
{
//Scan *.UI assembly for AutoMapper Profiles
var assembly = Assembly.Getassembly(typeof(AutoMapperFactory));
cfg.AddProfiles(assembly);
cfg.IgnoreAllUnmapped();
});
return config;
}
}
现在,显示cfg.AddProfiles(assembly)
的行给了我错误:Argument 1: cannot convert from 'System.Reflection.Assembly' to 'System.Collections.Generic.IEnumerable<AutoMapper.Profile>
如何获取IEnumerable<AutoMapper.Profile>
作为AddProfiles
的参数传递?