.net core autofac automapper

AutoMapper

AutoMapper.Extensions.Microsoft.DependencyInjection

first

public class AutoMapperSetup : Profile
{
public AutoMapperSetup()
{
//CreateMap();
}
}

second

startup.cs

services.AddAutoMapper(typeof(AutoMapperSetup));

 

Autofac

Autofac.Extensions.DependencyInjection

first

public class AutofacSetup : Module
{
protected override void Load(ContainerBuilder builder)
{
//builder.RegisterType().As().SingleInstance();

}
}

second

startup.cs

public void ConfigureContainer(ContainerBuilder builder)
{
builder.RegisterModule(new AutofacSetup());
}

 

转载于:https://www.cnblogs.com/lovewl2/p/11304228.html

你可能感兴趣的:(.net core autofac automapper)