Flexbase
Search…
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.
1
public class CustomerMapperConfiguration : FlexMapperProfile
2
{
3
/// <summary>
4
///
5
/// </summary>
6
public CustomerMapperConfiguration() : base()
7
{
8
#region Input
9
10
//Sample:
11
//CreateMap<YourAPIModel, YourDomainModel>();
12
13
CreateMap<AddCustomerInputAPIModel, Customer>();
14
CreateMap<UpdateCustomerInputAPIModel, Customer>();
15
16
#endregion
17
18
#region Output
19
20
//Sample:
21
//CreateMap<YourDomainModel, YourOutputAPIModel>();
22
23
CreateMap<Customer, GetCustomerByIdOutputAPIModel>();
24
CreateMap<Customer, GetCustomersForLookupOutputAPIModel>();
25
CreateMap<Customer, GetCustomersOutputAPIModel>();
26
27
#endregion
28
}
29
}
Copied!
Last modified 1yr ago
Copy link