- 
                Notifications
    
You must be signed in to change notification settings  - Fork 380
 
Async
        chaowlert edited this page Feb 2, 2020 
        ·
        1 revision
      
    PM> Install-Package Mapster.Async
This plugin allows you to perform async operation for mapping
Use AfterMappingAsync to setup async operation
config.NewConfig<Poco, Dto>()
    .AfterMappingAsync(async (poco, dto) =>
    {
        var userManager = MapContext.Current.GetService<UserManager>();
        var user = await userManager.FindByIdAsync(poco.UserId);
        dto.UserName = user.Name;
    });Then map asynchronously with AdaptToTypeAsync.
var dto = await poco.BuildAdapter()
    .AdaptToTypeAsync<Dto>();Or like this, if you use mapper instance.
var dto = await _mapper.From(poco)
    .AdaptToTypeAsync<Dto>();- Configuration
 - Config inheritance
 - Config instance
 - Config location
 - Config validation & compilation
 - Config for nested mapping
 
- Custom member matching logic
 - Constructor mapping
 - Before & after mapping
 - Setting values
 - Shallow & merge mapping
 - Recursive & object references
 - Custom conversion logic
 - Inheritance