.net core autofac automapper
AutoMapper
AutoMapper.Extensions.Microsoft.DependencyInjection
first
public class AutoMapperSetup : Profile
{
public AutoMapperSetup()
{
//CreateMap<model1, model2>();
}
}
second
startup.cs
services.AddAutoMapper(typeof(AutoMapperSetup));
Autofac
Autofac.Extensions.DependencyInjection
first
public class AutofacSetup : Module
{
protected override void Load(ContainerBuilder builder)
{
//builder.RegisterType<Service>().As<IService>().SingleInstance();
}
}
second
startup.cs
public void ConfigureContainer(ContainerBuilder builder)
{
builder.RegisterModule(new AutofacSetup());
}