.net core autofac automapper

前端之家收集整理的这篇文章主要介绍了.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()); }

猜你在找的.NET Core相关文章