-
-
Save tuannguyenssu/71995a9bdc7b9cf096a09a682d21f701 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
// Source Order -> Destination OrderDto | |
var config = new MapperConfiguration(cfg => cfg.CreateMap<Order, OrderDto>()); | |
// Khởi tạo mapper | |
//var mapper = config.CreateMapper(); | |
// Hoặc | |
var mapper = new Mapper(config); | |
// Kiểm tra cấu hình. Nếu có lỗi sẽ văng Exception (Development mode) | |
config.AssertConfigurationIsValid(); | |
// Tạo đối tượng mới từ đối tượng cũ thông qua mapper | |
OrderDto dto = mapper.Map<OrderDto>(order); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment