public static IServiceCollection AddMappers(this IServiceCollection services) { services.AddSingleton(MapperConfig.CreateMap()); services.AddScoped <IMapper, ServiceMapper>(); return(services); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); MapperConfig.CreateMap(); //初始化 Mapper }
static PaymentQueries() { MapperConfig.CreateMap(); }