-
-
Save tuannguyenssu/1fcdc5e76c1b72dfd36533a6d4b66251 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
// Cấu hình AutoMapper - Cách 1 | |
var mappingConfig = new MapperConfiguration(mc => | |
{ | |
mc.AddProfile(new MappingProfile()); | |
}); | |
mappingConfig.AssertConfigurationIsValid(); | |
IMapper mapper = mappingConfig.CreateMapper(); | |
services.AddSingleton(mapper); | |
// Cấu hình AutoMapper - Cách 2 cũ hơn | |
// Mapper.Initialize(cfg => cfg.AddProfile<MappingProfile>()); | |
// services.AddAutoMapper(); | |
services.AddControllersWithViews(); | |
services.AddRazorPages(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment