INSERT : Mapper

BasicCRUD Insert Query with Bridge

Now let us look at our next topic Mapper. By default the mappers are created for you. So each module has its one mapper file for you so that your organization of the mapping becomes easy. So you can use this file for your both input mapping and output mapping and this uses AutoMapper internally.

So you can refer the documentation for AutoMapper to learn further on automapper and for any advanced mapping concept.

public class CustomerMapperConfiguration : FlexMapperProfile
{
/// <summary>
///
/// </summary>
public CustomerMapperConfiguration() : base()
{
#region Input
//Sample:
//CreateMap<YourAPIModel, YourDomainModel>();
CreateMap<AddCustomerInputAPIModel, Customer>();
CreateMap<UpdateCustomerInputAPIModel, Customer>();
#endregion
#region Output
//Sample:
//CreateMap<YourDomainModel, YourOutputAPIModel>();
CreateMap<Customer, GetCustomerByIdOutputAPIModel>();
CreateMap<Customer, GetCustomersForLookupOutputAPIModel>();
CreateMap<Customer, GetCustomersOutputAPIModel>();
#endregion
}
}