.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());
}

 

posted @ 2019-08-05 17:16  lovewl  阅读(370)  评论(0编辑  收藏  举报